User.java
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.jersey.tests.e2e.json.entity;
import javax.json.bind.annotation.JsonbTransient;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
* @author Jakub Podlesak
*/
@SuppressWarnings({"StringEquality", "RedundantIfStatement", "UnusedDeclaration"})
@XmlRootElement
public class User {
@XmlElement(name = "userid")
public String id;
public String name;
@XmlTransient
@JsonbTransient
public String password;
public User() {
}
public User(String id, String name, String password) {
this.id = id;
this.name = name;
this.password = password;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof User)) {
return false;
}
final User other = (User) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
return false;
}
if (this.name != other.name && (this.name == null || !this.name.equals(other.name))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
if (null != id) {
hash = 17 * hash + id.hashCode();
}
if (null != name) {
hash = 17 * hash + name.hashCode();
}
return hash;
}
@Override
public String toString() {
return "User(" + id + ", " + name + ")";
}
public static Object createTestInstance() {
return new User("1621", "Grotefend", "Persepolis");
}
}