blob: 92129685fa0aa854388c8c40ebaabd72d9257f24 [file] [log] [blame]
/*
* Copyright (c) 2013, 2020 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,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// - rbarkhouse - 29 January 2013 - 2.4 - Initial implementation
package org.eclipse.persistence.testing.jaxb.idresolver.collection;
import java.util.ArrayList;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlID;
import jakarta.xml.bind.annotation.XmlIDREF;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlTransient;
import org.eclipse.persistence.oxm.annotations.XmlIDExtension;
@XmlRootElement
public class TestObject {
@XmlTransient
public boolean processed = false;
@XmlIDExtension
@XmlID
public int id;
public String name;
@XmlIDREF
public TestObject single;
@XmlIDREF
@XmlElement(name = "ref")
public ArrayList<TestObject> refs = new ArrayList<TestObject>();
@Override
public String toString() {
return "TestObject{" +
"processed=" + processed +
", id=" + id +
", name='" + name + '\'' +
", single=" + single +
", refs=" + refs +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TestObject that = (TestObject) o;
if (id != that.id) return false;
if (processed != that.processed) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (refs != null ? !refs.equals(that.refs) : that.refs != null) return false;
if (single != null ? !single.equals(that.single) : that.single != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (processed ? 1 : 0);
result = 31 * result + id;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (single != null ? single.hashCode() : 0);
result = 31 * result + (refs != null ? refs.hashCode() : 0);
return result;
}
}