net.sf.jso.util
Class JSOOID

java.lang.Object
  extended byjava.lang.Number
      extended bynet.sf.jso.util.JSOOID
All Implemented Interfaces:
CID, java.lang.Cloneable, java.lang.Comparable, OID, PID, java.io.Serializable, TID

public class JSOOID
extends java.lang.Number
implements OID, TID, CID, PID

Inteface for storable object identification. Object identification is represented by a long.

See Also:
Serialized Form

Constructor Summary
JSOOID()
          Constucts the OID.
JSOOID(long anOID)
          Constucts the OID.
JSOOID(java.lang.Object id)
          Constucts the OID.
 
Method Summary
 byte byteValue()
           
 java.lang.Object clone()
          Creates and returns a copy of this OID.
 int compareTo(java.lang.Object o)
          Compares the OID wiht anoter one.
 double doubleValue()
           
 boolean equals(java.lang.Object o)
          Indicates whether some other OID is "equal to" this one.
 float floatValue()
           
 long getOID()
          Returns the OID long identification.
 int hashCode()
          Returns a hash code value for the OID.
 int intValue()
           
 long longValue()
           
static JSOOID safellyCast(OID oid)
          Makes a cast from OID to JSOOID.
 short shortValue()
           
 java.lang.String toString()
          Returns a string representation of the OID.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSOOID

public JSOOID()
Constucts the OID.


JSOOID

public JSOOID(long anOID)
Constucts the OID.

Parameters:
anOID - A long identification.

JSOOID

public JSOOID(java.lang.Object id)
       throws java.lang.IllegalArgumentException
Constucts the OID.

Parameters:
id - A string or a Number with a representation of an object identification.
Method Detail

getOID

public long getOID()
Returns the OID long identification.

Returns:
The long identification.

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares the OID wiht anoter one.

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 the OID is less than, equal to, or greater than the specified OID.
Throws:
java.lang.ClassCastException - If o is not instance of JSOOOID.

equals

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

Parameters:
o - The object with which to compare.
Returns:
true if the OID is the same as the OID argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the OID.

Returns:
A hash code value for the OID.

toString

public java.lang.String toString()
Returns a string representation of the OID.

Returns:
A string representation of the OID.

clone

public java.lang.Object clone()
Creates and returns a copy of this OID.

Returns:
A clone of this instance.

byteValue

public byte byteValue()

doubleValue

public double doubleValue()

floatValue

public float floatValue()

intValue

public int intValue()

longValue

public long longValue()

shortValue

public short shortValue()

safellyCast

public static JSOOID safellyCast(OID oid)
                          throws StorageException
Makes a cast from OID to JSOOID.

Parameters:
oid - A reference to a potential JSOOID.
Returns:
The same OID reference as JSOOID.
Throws:
StorageException - If oid is not a JSOOID.