org.apache.jdo.tck.pc.company
Class Person

java.lang.Object
  extended byorg.apache.jdo.tck.pc.company.Person
All Implemented Interfaces:
java.lang.Comparable, DeepEquality, java.io.Serializable
Direct Known Subclasses:
Employee

public class Person
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, DeepEquality

This class represents a person.

See Also:
Serialized Form

Nested Class Summary
static class Person.Oid
          This class is used to represent the application identifier for the Person class.
 
Field Summary
protected static java.text.SimpleDateFormat formatter
           
 
Constructor Summary
protected Person()
          This is the JDO-required no-args constructor.
  Person(long personid, java.lang.String firstname, java.lang.String lastname, java.lang.String middlename, java.util.Date birthdate, Address address)
          Initialize a Person instance.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(Person other)
          Compares this object with the specified Person object for order.
 boolean deepCompareFields(DeepEquality other, EqualityHelper helper)
          Returns true if all the fields of this instance are deep equal to the coresponding fields of the specified Person.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 Address getAddress()
          Get the address.
 java.util.Date getBirthdate()
          Get the person's birthdate.
 java.lang.String getFirstname()
          Get the person's first name.
 java.lang.String getLastname()
          Get the person's last name.
 java.lang.String getMiddlename()
          Get the person's middle name.
 long getPersonid()
          Get the person's id.
 java.lang.String getPhoneNumber(java.lang.String type)
          Get the phone number for the specified phone number type.
 java.util.Map getPhoneNumbers()
          Get the map of phone numbers as an unmodifiable map.
 int hashCode()
          Returns a hash code value for the object.
 java.lang.String putPhoneNumber(java.lang.String type, java.lang.String phoneNumber)
          Associates the specified phone number with the specified type in the map of phone numbers of this person.
 java.lang.String removePhoneNumber(java.lang.String type)
          Remove a phoneNumber from the map of phone numbers.
 void setAddress(Address address)
          Set the address.
 void setBirthdate(java.util.Date birthdate)
          Set the person's birthdate.
 void setFirstname(java.lang.String firstname)
          Set the person's first name.
 void setLastname(long personid)
          Set the person's id.
 void setLastname(java.lang.String lastname)
          Set the person's last name.
 void setMiddlename(java.lang.String middlename)
          Set the person's middle name.
 void setPhoneNumbers(java.util.Map phoneNumbers)
          Set the phoneNumber map to be in this person.
 java.lang.String toString()
          Return a String representation of a Person object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

formatter

protected static java.text.SimpleDateFormat formatter
Constructor Detail

Person

protected Person()
This is the JDO-required no-args constructor.


Person

public Person(long personid,
              java.lang.String firstname,
              java.lang.String lastname,
              java.lang.String middlename,
              java.util.Date birthdate,
              Address address)
Initialize a Person instance.

Parameters:
personid - The person identifier.
firstname - The person's first name.
lastname - The person's last name.
middlename - The person's middle name.
birthdate - The person's birthdate.
address - The person's address.
Method Detail

getPersonid

public long getPersonid()
Get the person's id.

Returns:
The personid.

setLastname

public void setLastname(long personid)
Set the person's id.

Parameters:
personid - The personid.

getLastname

public java.lang.String getLastname()
Get the person's last name.

Returns:
The last name.

setLastname

public void setLastname(java.lang.String lastname)
Set the person's last name.

Parameters:
lastname - The last name.

getFirstname

public java.lang.String getFirstname()
Get the person's first name.

Returns:
The first name.

setFirstname

public void setFirstname(java.lang.String firstname)
Set the person's first name.

Parameters:
firstname - The first name.

getMiddlename

public java.lang.String getMiddlename()
Get the person's middle name.

Returns:
The middle name.

setMiddlename

public void setMiddlename(java.lang.String middlename)
Set the person's middle name.

Parameters:
middlename - The middle name.

getAddress

public Address getAddress()
Get the address.

Returns:
The address.

setAddress

public void setAddress(Address address)
Set the address.

Parameters:
address - The address.

getBirthdate

public java.util.Date getBirthdate()
Get the person's birthdate.

Returns:
The person's birthdate.

setBirthdate

public void setBirthdate(java.util.Date birthdate)
Set the person's birthdate.

Parameters:
birthdate - The person's birthdate.

getPhoneNumbers

public java.util.Map getPhoneNumbers()
Get the map of phone numbers as an unmodifiable map.

Returns:
The map of phone numbers, as an unmodifiable map.

getPhoneNumber

public java.lang.String getPhoneNumber(java.lang.String type)
Get the phone number for the specified phone number type.

Parameters:
type - The phone number type ("home", "work", "mobile", etc.).
Returns:
The phone number associated with specified type, or null if there was no phone number for the type.

putPhoneNumber

public java.lang.String putPhoneNumber(java.lang.String type,
                                       java.lang.String phoneNumber)
Associates the specified phone number with the specified type in the map of phone numbers of this person.

Parameters:
type - The phone number type ("home", "work", "mobile", etc.).
phoneNumber - The phone number
Returns:
The previous phone number associated with specified type, or null if there was no phone number for the type.

removePhoneNumber

public java.lang.String removePhoneNumber(java.lang.String type)
Remove a phoneNumber from the map of phone numbers.

Parameters:
type - The phone number type ("home", "work", "mobile", etc.).
Returns:
The previous phone number associated with specified type, or null if there was no phone number for the type.

setPhoneNumbers

public void setPhoneNumbers(java.util.Map phoneNumbers)
Set the phoneNumber map to be in this person.

Parameters:
phoneNumbers - The map of phoneNumbers for this person.

toString

public java.lang.String toString()
Return a String representation of a Person object.


deepCompareFields

public boolean deepCompareFields(DeepEquality other,
                                 EqualityHelper helper)
Returns true if all the fields of this instance are deep equal to the coresponding fields of the specified Person.

Specified by:
deepCompareFields in interface DeepEquality
Parameters:
other - the object with which to compare.
helper - EqualityHelper to keep track of instances that have already been processed.
Returns:
true if all the fields are deep equal; false otherwise.
Throws:
java.lang.ClassCastException - if the specified instances' type prevents it from being compared to this instance.

compareTo

public int compareTo(java.lang.Object 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.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - - if the specified object's type prevents it from being compared to this Object.

compareTo

public int compareTo(Person 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.

Parameters:
other - The Person object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified Person object.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Parameters:
obj - the object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
a hash code value for this object.


Copyright © 2005 Apache Software Foundation. All Rights Reserved.