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, DeepEquality, java.io.Serializable

public class Company
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, 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.
 
Constructor Summary
protected Company()
          This is the JDO-required no-args constructor
  Company(long companyid, java.lang.String name, java.util.Date founded, Address addr)
          Initialize the Company instance.
 
Method Summary
 void addDepartment(Department dept)
          Add a Department instance to the company.
 int compareTo(Company 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(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 of the company.
 long getCompanyid()
          Get the company id.
 java.util.Set getDepartments()
          Get the departments contained in the company.
 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(Address address)
          Set the primary address for the company.
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Company

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


Company

public Company(long companyid,
               java.lang.String name,
               java.util.Date founded,
               Address 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.

Returns:
The company id.

getName

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

Returns:
The name of the company.

setName

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

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.

Returns:
The date the company was founded.

setFounded

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

Parameters:
founded - The date to set that the company was founded.

getAddress

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

Returns:
The primary address of the company.

setAddress

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

Parameters:
address - The address to set for the company.

getDepartments

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

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.

Parameters:
departments - The set of Departments for the company.

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(Company 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.

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-2007 Apache Software Foundation. All Rights Reserved.