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

java.lang.Object
  extended byorg.apache.jdo.tck.pc.company.Address
All Implemented Interfaces:
java.lang.Comparable, java.util.Comparator, DeepEquality, IAddress, java.io.Serializable

public class Address
extends java.lang.Object
implements IAddress, java.io.Serializable, java.lang.Comparable, java.util.Comparator, DeepEquality

This class represents a postal address.

See Also:
Serialized Form

Nested Class Summary
static class Address.Oid
          This class is used to represent the application identifier for the Address class.
 
Constructor Summary
Address()
          This is the JDO-required no-args constructor.
Address(long addrid, java.lang.String street, java.lang.String city, java.lang.String state, java.lang.String zipcode, java.lang.String country)
          This constructor initializes the Address components.
 
Method Summary
static int compare(IAddress o1, IAddress o2)
          Compares its two IAddress arguments for order.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two instances.
 int compareTo(IAddress other)
          Compares this object with the specified Address object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean deepCompareFields(java.lang.Object 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.
 long getAddrid()
          Get the addrid associated with this object.
 java.lang.String getCity()
          Get the city.
 java.lang.String getCountry()
          Get the country component of the address.
protected  java.lang.String getFieldRepr()
          Returns a String representation of the non-relationship fields.
 java.lang.String getState()
          Get the state component of the address.
 java.lang.String getStreet()
          Get the street component of the address.
 java.lang.String getZipcode()
          Get the zipcode component of the address.
 int hashCode()
          Returns a hash code value for the object.
 void setAddrid(long id)
          Set the id associated with this object.
 void setCity(java.lang.String city)
          Set the city component of the address.
 void setCountry(java.lang.String country)
          Set the country component of the address.
 void setState(java.lang.String state)
          Set the state component of the address.
 void setStreet(java.lang.String street)
          Set the street component of the address.
 void setZipcode(java.lang.String zipcode)
          Set the zip code component of the address.
 java.lang.String toString()
          Returns a String representation of a Adress object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Address

public Address()
This is the JDO-required no-args constructor. The TCK relies on this constructor for testing PersistenceManager.newInstance(PCClass).


Address

public Address(long addrid,
               java.lang.String street,
               java.lang.String city,
               java.lang.String state,
               java.lang.String zipcode,
               java.lang.String country)
This constructor initializes the Address components.

Parameters:
addrid - The address ID.
street - The street address.
city - The city.
state - The state.
zipcode - The zip code.
country - The zip country.
Method Detail

getAddrid

public long getAddrid()
Get the addrid associated with this object.

Specified by:
getAddrid in interface IAddress
Returns:
the addrid.

setAddrid

public void setAddrid(long id)
Set the id associated with this object.

Specified by:
setAddrid in interface IAddress
Parameters:
id - the id.

getStreet

public java.lang.String getStreet()
Get the street component of the address.

Specified by:
getStreet in interface IAddress
Returns:
The street component of the address.

setStreet

public void setStreet(java.lang.String street)
Set the street component of the address.

Specified by:
setStreet in interface IAddress
Parameters:
street - The street component.

getCity

public java.lang.String getCity()
Get the city.

Specified by:
getCity in interface IAddress
Returns:
The city component of the address.

setCity

public void setCity(java.lang.String city)
Set the city component of the address.

Specified by:
setCity in interface IAddress
Parameters:
city - The city.

getState

public java.lang.String getState()
Get the state component of the address.

Specified by:
getState in interface IAddress
Returns:
The state.

setState

public void setState(java.lang.String state)
Set the state component of the address.

Specified by:
setState in interface IAddress
Parameters:
state - The state.

getZipcode

public java.lang.String getZipcode()
Get the zipcode component of the address.

Specified by:
getZipcode in interface IAddress
Returns:
The zipcode.

setZipcode

public void setZipcode(java.lang.String zipcode)
Set the zip code component of the address.

Specified by:
setZipcode in interface IAddress
Parameters:
zipcode - The zipcode.

getCountry

public java.lang.String getCountry()
Get the country component of the address.

Specified by:
getCountry in interface IAddress
Returns:
The country.

setCountry

public void setCountry(java.lang.String country)
Set the country component of the address.

Specified by:
setCountry in interface IAddress
Parameters:
country - The country.

toString

public java.lang.String toString()
Returns a String representation of a Adress object.

Returns:
a String representation of a Adress object.

getFieldRepr

protected java.lang.String getFieldRepr()
Returns a String representation of the non-relationship fields.

Returns:
a String representation of the non-relationship fields.

deepCompareFields

public boolean deepCompareFields(java.lang.Object 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.

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare two instances. This is a method in Comparator.

Specified by:
compare in interface java.util.Comparator

compareTo

public int compareTo(IAddress other)
Compares this object with the specified Address 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 Address 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 Address object.

compare

public static int compare(IAddress o1,
                          IAddress o2)
Compares its two IAddress 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.

Parameters:
o1 - the first IAddress object to be compared.
o2 - the second IAddress object to be compared.
Returns:
a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the second object.

equals

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

Specified by:
equals in interface java.util.Comparator
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-2007 Apache Software Foundation. All Rights Reserved.