All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.netdeploy.ID

java.lang.Object
   |
   +----com.ibm.beans.netdeploy.ID

public abstract class ID
extends Object
implements Serializable
The ID class contains a binary value that is used to uniquely identify software objects.


Variable Index

 o INVALID_ID_VALUE
Indicates that an ID instance has an invalid value, and should not be used as a unique identifier until a new value is set.
 o nValueBytes
Indicates the number of bytes required to contain the value of an instance of class ID.
 o nValueDigits
Indicates the number of hexadecimal digits required to encode the value for an instance of class ID.

Constructor Index

 o ID()
Creates a new ID instance, with an empty value.
 o ID(String)
Creates a new ID instance, using an externally supplied value.

Method Index

 o equals(Object)
Tests two objects of class ID for equality.
 o hashCode()
Returns the hash code value for this ID instance.
 o setValue(byte[])
Sets the value of this ID instance.
 o toString()
Returns the value of this ID instance in the form of a string.

Variables

 o INVALID_ID_VALUE
 public static final String INVALID_ID_VALUE
Indicates that an ID instance has an invalid value, and should not be used as a unique identifier until a new value is set.

 o nValueBytes
 public static final int nValueBytes
Indicates the number of bytes required to contain the value of an instance of class ID.

 o nValueDigits
 public static final int nValueDigits
Indicates the number of hexadecimal digits required to encode the value for an instance of class ID. The current value is 32.

Constructors

 o ID
 public ID()
Creates a new ID instance, with an empty value. This constructor should only be called by factory methods.

New ID instances should normally be acquired from a factory method, and not instantiated directly. The reason for this is that, in order to avoid ID collisions, the value must either be dispensed one-after-another from a single distribution point, or chosen randomly from a large space using a secure random number source.

Therefore, if the IDs are being dispensed from a centralized source, the factory method of that source should be called. If they are being randomly chosen, the value should be set from a good random number source, such as a hardware generator, or the java.security.SecureRandom class. In the hardware case, a factory method will be obviously be needed, in order to make native calls to the hardware random number generator.

Lastly, in the case of java.security.SecureRandom, this class typically takes several minutes to initialize. For performance reasons, a single instance should be kept, within a factory method on a relatively permanent object.

If an ID instance must be constructed directly, be sure to immediately set the value, using setValue().

 o ID
 public ID(String valueString)
Creates a new ID instance, using an externally supplied value.

Parameters:
valueString - A string containing the value for this ID instance, encoded as a series of hexadecimal digits. The string must contain exactly nValueDigits hexadecimal digits.

Methods

 o setValue
 public void setValue(byte valueBytes[])
Sets the value of this ID instance.

This method should only be called during deserialization, or from factory methods.

Parameters:
valueBytes - An array of bytes. This must contain exactly nValueBytes values.
 o toString
 public String toString()
Returns the value of this ID instance in the form of a string.

Returns:
A string containing the value for this ID instance, encoded as a series of hexadecimal digits. The string will contain exactly nValueDigits hexadecimal digits.
Overrides:
toString in class Object
 o equals
 public boolean equals(Object obj)
Tests two objects of class ID for equality.

Returns:
true if obj is a valid instance of class ID, and has the same value as this ID instance; false otherwise.
Overrides:
equals in class Object
 o hashCode
 public int hashCode()
Returns the hash code value for this ID instance.

Returns:
The hash code value for this ID instance.
Overrides:
hashCode in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index