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

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

public class Company
extends java.lang.Object
implements ICompany, java.io.Serializable, java.lang.Comparable, java.util.Comparator, DeepEquality

This class represents information about a company.

See Also:
Serialized Form

Nested Class Summary
static class Company.Oid
          The class to be used as the application identifier for the Company class.
 
Field Summary
protected static java.text.SimpleDateFormat formatter
           
 
Constructor Summary
Company()
          This is the JDO-required no-args constructor.
Company(long companyid, java.lang.String name, java.util.Date founded)
          Initialize the Company instance.
Company(long companyid, java.lang.String name, java.util.Date founded, IAddress addr)
          Initialize the Company instance.
 
Method Summary
 void addDepartment(Department dept)
          Add a Department instance to the company.
static int compare(ICompany o1, ICompany o2)
          Compares its two ICompany arguments for order.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two instances.
 int compareTo(ICompany other)
          Compares this object with the specified Company 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.
 IAddress getAddress()
          Get the address of the company.
 long getCompanyid()
          Get the company id.
 java.util.Set getDepartments()
          Get the departments contained in the company.
protected  java.lang.String getFieldRepr()
          Returns a String representation of the non-relationship fields.
 java.util.Date getFounded()
          Get the date that the company was founded.
 java.lang.String getName()
          Get the name of the company.
 int hashCode()
          Returns a hash code value for the object.
 void removeDepartment(Department dept)
          Remove a Department instance from the company.
 void setAddress(IAddress address)
          Set the primary address for the company.
 void setCompanyid(long id)
          Set the id associated with this object.
 void setDepartments(java.util.Set departments)
          Initialize the set of Departments in the company to the parameter.
 void setFounded(java.util.Date founded)
          Set the date that the company was founded.
 void setName(java.lang.String name)
          Set the name of the company.
 java.lang.String toString()
          Returns a String representation of a Company 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

Company

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


Company

public Company(long companyid,
               java.lang.String name,
               java.util.Date founded)
Initialize the Company instance.

Parameters:
companyid - The company id.
name - The company name.
founded - The date the company was founded.

Company

public Company(long companyid,
               java.lang.String name,
               java.util.Date founded,
               IAddress addr)
Initialize the Company instance.

Parameters:
companyid - The company id.
name - The company name.
founded - The date the company was founded.
addr - The company's address.
Method Detail

getCompanyid

public long getCompanyid()
Get the company id.

Specified by:
getCompanyid in interface ICompany
Returns:
The company id.

setCompanyid

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

Specified by:
setCompanyid in interface ICompany
Parameters:
id - the id.

getName

public java.lang.String getName()
Get the name of the company.

Specified by:
getName in interface ICompany
Returns:
The name of the company.

setName

public void setName(java.lang.String name)
Set the name of the company.

Specified by:
setName in interface ICompany
Parameters:
name - The value to use for the name of the company.

getFounded

public java.util.Date getFounded()
Get the date that the company was founded.

Specified by:
getFounded in interface ICompany
Returns:
The date the company was founded.

setFounded

public void setFounded(java.util.Date founded)
Set the date that the company was founded.

Specified by:
setFounded in interface ICompany
Parameters:
founded - The date to set that the company was founded.

getAddress

public IAddress getAddress()
Get the address of the company.

Specified by:
getAddress in interface ICompany
Returns:
The primary address of the company.

setAddress

public void setAddress(IAddress address)
Set the primary address for the company.

Specified by:
setAddress in interface ICompany
Parameters:
address - The address to set for the company.

getDepartments

public java.util.Set getDepartments()
Get the departments contained in the company.

Specified by:
getDepartments in interface ICompany
Returns:
An unmodifiable Set that contains all the Departments of the company.

addDepartment

public void addDepartment(Department dept)
Add a Department instance to the company.

Parameters:
dept - The Department instance to add.

removeDepartment

public void removeDepartment(Department dept)
Remove a Department instance from the company.

Parameters:
dept - The Department instance to remove.

setDepartments

public void setDepartments(java.util.Set departments)
Initialize the set of Departments in the company to the parameter.

Specified by:
setDepartments in interface ICompany
Parameters:
departments - The set of Departments for the company.

toString

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

Returns:
a String representation of a Company 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(ICompany other)
Compares this object with the specified Company 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 Company 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 Company object.

compare

public static int compare(ICompany o1,
                          ICompany o2)
Compares its two ICompany 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 ICompany object to be compared.
o2 - the second ICompany 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.