org.teiid.core.id
Class UUID

java.lang.Object
  extended by org.teiid.core.id.UUID
All Implemented Interfaces:
java.io.Serializable

public class UUID
extends java.lang.Object
implements java.io.Serializable

This class represents a universally unique identifier, consisting of two long integral values.

This identifier is supposed to be unique both spatially and temporally. It is based on version 4 IETF variant random UUIDs.

See Also:
Serialized Form

Field Summary
static int FQ_LENGTH
           
static java.lang.String PROTOCOL
           
static java.lang.String PROTOCOL_UCASE
           
 
Constructor Summary
UUID(long mostSig, long leastSig)
          Construct an instance of this class from two long integral values.
UUID(java.util.UUID uuid)
           
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 java.lang.String exportableForm()
          Returns a 36-character string of six fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field.
 java.lang.String getProtocol()
          Return the name of the protocol that this factory uses.
 int hashCode()
          Returns the hashcode for this instance.
 java.lang.String toString()
          Returns a string representing the current state of the object.
 java.lang.String toString(char delim)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROTOCOL

public static final java.lang.String PROTOCOL
See Also:
Constant Field Values

PROTOCOL_UCASE

public static final java.lang.String PROTOCOL_UCASE

FQ_LENGTH

public static final int FQ_LENGTH
Constructor Detail

UUID

public UUID(long mostSig,
            long leastSig)
Construct an instance of this class from two long integral values. Both values must be non-negative.

Throws:
java.lang.IllegalArgumentException - if either value is negative

UUID

public UUID(java.util.UUID uuid)
Method Detail

getProtocol

public java.lang.String getProtocol()
Return the name of the protocol that this factory uses.

Returns:
the protocol name

hashCode

public int hashCode()
Returns the hashcode for this instance. All of the bits in each 32-bit part of the longs are exclusively 'or'd together to yield the hashcode.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo() .

UUID instances are equal if they represent the same 128-bit value.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

compareTo

public int compareTo(java.lang.Object obj)

Compares this object to another. If the specified object is not an instance of the LongID class, then this method throws a ClassCastException (as instances are comparable only to instances of the same class).

Note: this method is consistent with equals(), meaning that (compare(x, y)==0) == (x.equals(y)).

Parameters:
obj - the object that this instance is to be compared to; may not be null.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this instance.

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this instance.

toString

public java.lang.String toString(char delim)
See Also:
id.ObjectID

exportableForm

public java.lang.String exportableForm()

Returns a 36-character string of six fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field. The order of fields is: time_low, time_mid, version and time_hi treated as a single field, variant and clock_seq treated as a single field, and node.

Returns:
A string of the form 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', where all the characters are lowercase hexadecimal digits


Copyright © 2011. All Rights Reserved.