blob: ef659002862ed9670fea6339a6c548f94727306e [file] [log] [blame]
/*
* Copyright (c) 1998, 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:
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.oxm.mappings.directcollection.union;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class Person {
private String firstName;
private String lastName;
private ArrayList items;
public Person() {
items = new ArrayList();
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String newFirstName) {
firstName = newFirstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String newLastName) {
lastName = newLastName;
}
public ArrayList getItems() {
return items;
}
public void setItems(ArrayList newItems) {
items = newItems;
}
public void addItem(Object newItem) {
items.add(newItem);
}
public boolean equals(Object object) {
try {
Person person = (Person)object;
if (!this.getFirstName().equals(person.getFirstName())) {
return false;
}
if (!this.getLastName().equals(person.getLastName())) {
return false;
}
if (this.getItems().size() != person.getItems().size()) {
return false;
}
for (int i = 0; i < this.getItems().size(); i++) {
Object nextDate = this.getItems().get(i);
Object otherDate = person.getItems().get(i);
if (!(nextDate.equals(otherDate))) {
return false;
}
}
return true;
} catch (ClassCastException e) {
return false;
}
}
public String toString() {
String returnString = "fname:" + this.getFirstName() + " lname:" + this.getLastName();
for (int i = 0; i < this.getItems().size(); i++) {
Object nextDate = this.getItems().get(i);
returnString += (" nextDate: " + nextDate);
returnString += (" nextDateClass: " + nextDate.getClass());
}
return returnString;
}
}