Openwings API Documentation (v1.1)

net.openwings.identity
Class UniqueID

java.lang.Object
  extended bynet.openwings.identity.UniqueID
All Implemented Interfaces:
java.io.Serializable

public final class UniqueID
extends java.lang.Object
implements java.io.Serializable

This interface defines a unique identifier that can be used throughout the Openwings framework. For example:

Here are the requirements for implementing this interface: Here are the goals for implementing this interface:

See Also:
Serialized Form

Constructor Summary
UniqueID(byte[] newBytes)
          This constructor generates a new unique identifier based on an array of bytes.
UniqueID(java.lang.String string)
          This constructor generates a new unique identifier based on a string returned from the toString() method
 
Method Summary
 boolean equals(java.lang.Object other)
          Overrides the default implementation from Object.
 byte[] getBytes()
          This method is provided as a convenience for conversion between different types of identifiers used in various frameworks.
 int hashCode()
          Overrides the default implementation from Object.
 void setBytes(byte[] newBytes)
          This method is provided as a convenience for conversion between different types of identifiers used in various frameworks.
 java.lang.String toString()
          Returns a hex representation of the bytes as a string, with a space separating each 4-byte (int) group.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UniqueID

public UniqueID(byte[] newBytes)
         throws java.lang.IllegalArgumentException
This constructor generates a new unique identifier based on an array of bytes. It uses up to SIZE bytes of information from the array, copying the least significant bytes first


UniqueID

public UniqueID(java.lang.String string)
         throws java.lang.NumberFormatException
This constructor generates a new unique identifier based on a string returned from the toString() method

Method Detail

getBytes

public byte[] getBytes()
This method is provided as a convenience for conversion between different types of identifiers used in various frameworks.

Returns:
bytes of the unique identifier. The array is guaranteed to have a length that is a multiple of 4 greater than 16.

setBytes

public void setBytes(byte[] newBytes)
This method is provided as a convenience for conversion between different types of identifiers used in various frameworks.

Parameters:
newBytes - bytes of the unique identifier. The array must have a length that is a multiple of 4 greater than 16.

equals

public boolean equals(java.lang.Object other)
Overrides the default implementation from Object.


hashCode

public int hashCode()
Overrides the default implementation from Object.


toString

public java.lang.String toString()
Returns a hex representation of the bytes as a string, with a space separating each 4-byte (int) group.


Openwings API Documentation (v1.1)