org.hydrateframework
Class ObjectKey.Int

java.lang.Object
  extended by org.hydrateframework.ObjectKey.Int
All Implemented Interfaces:
Constraint, ObjectKey
Enclosing interface:
ObjectKey

public abstract static class ObjectKey.Int
extends java.lang.Object
implements ObjectKey

This partial implementation of the ObjectKey interface is used by objects that have a primary key whose underlying type is an int

Version:
1.0
Author:
chamda

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hydrateframework.ObjectKey
ObjectKey.Complex, ObjectKey.Int, ObjectKey.Str
 
Field Summary
protected  int m_val
          The integer that holds the value of this key
 
Fields inherited from interface org.hydrateframework.ObjectKey
m_log
 
Constructor Summary
ObjectKey.Int()
          Construct key with a value set to null.
ObjectKey.Int(int val)
           
ObjectKey.Int(java.lang.Object val)
          Construct a new key with a value read from the given object.
 
Method Summary
 boolean equals(java.lang.Object o)
          determine if two keys are equal.
 int hashCode()
          return a hashcode value for this key.
 int intValue()
          Return an integer value that represents this key.
 boolean isPersisted()
          Has the object associated with this key been persisted in the database
 void setNotPersisted()
          Set object to indicate it is not persisted.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hydrateframework.ObjectKey
constrainQuery, getKeyName, initObject
 

Field Detail

m_val

protected int m_val
The integer that holds the value of this key

Constructor Detail

ObjectKey.Int

public ObjectKey.Int()
Construct key with a value set to null.


ObjectKey.Int

public ObjectKey.Int(java.lang.Object val)
Construct a new key with a value read from the given object. The function uses the intValue() method of the given object if it a Numeric or Integer.parseInt() on the result from toString() if not.


ObjectKey.Int

public ObjectKey.Int(int val)
Method Detail

equals

public boolean equals(java.lang.Object o)
Description copied from interface: ObjectKey
determine if two keys are equal. Keys are equal if the objects to which they refer should have the same physical identity in the database. This means that keys that are null are only equal if the objects match with '==' whereas non null keys are equal if their internal values are equal.

Specified by:
equals in interface ObjectKey
Overrides:
equals in class java.lang.Object
Returns:
true if the keys are the same

hashCode

public int hashCode()
Description copied from interface: ObjectKey
return a hashcode value for this key. The hashCode must be the same for two objects if the call to equals returns true. They need not be different if the call returns false but, since keys will be indexed using a the hash code, performance of these indexes will be much improved if they do return distinct results.

Specified by:
hashCode in interface ObjectKey
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

intValue

public int intValue()
Description copied from interface: ObjectKey
Return an integer value that represents this key. This only really makes any sense if the underlying type of the key is integer, or some integer that is shorter.

Specified by:
intValue in interface ObjectKey
Returns:
the integer representation of this key.

isPersisted

public boolean isPersisted()
Description copied from interface: ObjectKey
Has the object associated with this key been persisted in the database

Specified by:
isPersisted in interface ObjectKey
Returns:
true if the object is in the database.

setNotPersisted

public void setNotPersisted()
Description copied from interface: ObjectKey
Set object to indicate it is not persisted.

Specified by:
setNotPersisted in interface ObjectKey


Copyright © 2000 The Hydrate Project. All Rights Reserved.