OpMath

com.opmath.test.j2ee.contact
Class ContactPK

java.lang.Object
  |
  +--com.opmath.test.j2ee.contact.ContactPK
All Implemented Interfaces:
Serializable

public class ContactPK
extends Object
implements Serializable

The primary key class for the Contact EJB. This is in fact a simple primary key - this class simply delegates to / wraps a long.

Copyright: (c) 2002 The Open Math Company Limited

The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.

Since:
J2SDK 1.3.1, J2SDKEE 1.3.1, EJB 2.0
Version:
OpMath J2EE Example v1.0
Author:
Bruno Beloff bruno.beloff@opmath.com
See Also:
ContactBean, Serialized Form

Field Summary
 long id
          The id of the key.
 
Constructor Summary
ContactPK(long id)
          Constructs a new ContactPK.
 
Method Summary
 boolean equals(Object o)
          Returns true iff the given Object is the same class as this instance, and has the same id.
 long getId()
          Returns the id of this ContactPK.
 int hashCode()
          Returns the hash code for this ContactPK.
 String toString()
          Returns a descriptive string for this ContactPK instance.
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public long id

The id of the key. This is the only instance variable for this class. Note that it is declared as public to match EJB recommendations [ http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/CMP.html].

Constructor Detail

ContactPK

public ContactPK(long id)

Constructs a new ContactPK. The new ContactPK instance has the given id.

Parameters:
id - a String specifying the index of the new instance.
Method Detail

getId

public long getId()

Returns the id of this ContactPK.

Returns:
a long carrying the index of this ContactPK.

equals

public boolean equals(Object o)

Returns true iff the given Object is the same class as this instance, and has the same id.

Overrides:
equals in class Object
Returns:
a boolean indicating equivalance.

hashCode

public int hashCode()

Returns the hash code for this ContactPK. The value returned is the hash code of a Longconstructed from the id of this ContactPK.

Overrides:
hashCode in class Object
Returns:
an int hash code.

toString

public String toString()

Returns a descriptive string for this ContactPK instance.

Overrides:
toString in class Object
Returns:
a descriptive String.

OpMath

Submit a bug or feature to Open Math
Copyright © 2002 Open Math Company Limited, Brighton, UK