Method from org.apache.jdo.tck.pc.company.Person Detail: |
public int compare(Object o1,
Object o2) {
return compare((IPerson)o1, (IPerson)o2);
}
Compare two instances. This is a method in Comparator. |
public static int compare(IPerson o1,
IPerson o2) {
return EqualityHelper.compare(o1.getPersonid(), o2.getPersonid());
}
Compares its two IPerson arguments for order. Returns a negative
integer, zero, or a positive integer as the first argument is less
than, equal to, or greater than the second. |
public int compareTo(Object o) {
return compareTo((IPerson)o);
}
Compares this object with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object. |
public int compareTo(IPerson other) {
return compare(this, other);
}
Compares this object with the specified Person object for
order. Returns a negative integer, zero, or a positive integer as
this object is less than, equal to, or greater than the specified
object. |
public boolean deepCompareFields(Object other,
EqualityHelper helper) {
IPerson otherPerson = (IPerson)other;
String where = "Person< " + personid + " >";
return
helper.equals(personid, otherPerson.getPersonid(), where + ".personid") &
helper.equals(firstname, otherPerson.getFirstname(), where + ".firstname") &
helper.equals(lastname, otherPerson.getLastname(), where + ".lastname") &
helper.equals(middlename, otherPerson.getMiddlename(), where + ".middlename") &
helper.equals(birthdate, otherPerson.getBirthdate(), where + ".birthdate") &
helper.deepEquals(address, otherPerson.getAddress(), where + ".address") &
helper.deepEquals(phoneNumbers, otherPerson.getPhoneNumbers(), where + ".phoneNumbers");
}
Returns true if all the fields of this instance are
deep equal to the coresponding fields of the specified Person. |
public boolean equals(Object obj) {
if (obj instanceof IPerson) {
return compareTo((IPerson)obj) == 0;
}
return false;
}
Indicates whether some other object is "equal to" this one. |
public IAddress getAddress() {
return address;
}
|
public Date getBirthdate() {
return birthdate;
}
Get the person's birthdate. |
protected String getFieldRepr() {
StringBuffer rc = new StringBuffer();
rc.append(personid);
rc.append(", ").append(lastname);
rc.append(", ").append(firstname);
rc.append(", born ").append(formatter.format(birthdate));
rc.append(", phone ").append(phoneNumbers);
return rc.toString();
}
Returns a String representation of the non-relationship fields. |
public String getFirstname() {
return firstname;
}
Get the person's first name. |
public String getLastname() {
return lastname;
}
Get the person's last name. |
public String getMiddlename() {
return middlename;
}
Get the person's middle name. |
public long getPersonid() {
return personid;
}
|
public String getPhoneNumber(String type) {
return (String)phoneNumbers.get(type);
}
Get the phone number for the specified phone number type. |
public Map getPhoneNumbers() {
return Collections.unmodifiableMap(phoneNumbers);
}
Get the map of phone numbers as an unmodifiable map. |
public int hashCode() {
return (int)personid;
}
Returns a hash code value for the object. |
public String putPhoneNumber(String type,
String phoneNumber) {
return (String)phoneNumbers.put(type, phoneNumber);
}
Associates the specified phone number with the specified type in the
map of phone numbers of this person. |
public String removePhoneNumber(String type) {
return (String)phoneNumbers.remove(type);
}
Remove a phoneNumber from the map of phone numbers. |
public void setAddress(IAddress address) {
this.address = (Address)address;
}
|
public void setBirthdate(Date birthdate) {
this. birthdate = birthdate;
}
Set the person's birthdate. |
public void setFirstname(String firstname) {
this.firstname = firstname;
}
Set the person's first name. |
public void setLastname(long personid) {
this.personid = personid;
}
|
public void setLastname(String lastname) {
this.lastname = lastname;
}
Set the person's last name. |
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
Set the person's middle name. |
public void setPersonid(long id) {
if (this.personid != 0)
throw new IllegalStateException("Id is already set.");
this.personid = id;
}
Set the id associated with this object. |
public void setPhoneNumbers(Map phoneNumbers) {
// workaround: create a new HashMap, because fostore does not
// support LinkedHashMap
this.phoneNumbers =
(phoneNumbers != null) ? new HashMap(phoneNumbers) : null;
}
Set the phoneNumber map to be in this person. |
public String toString() {
return "Person(" + getFieldRepr() + ")";
}
Returns a String representation of a Person object. |