public class TimeUuid extends java.lang.Object implements java.lang.Comparable<TimeUuid>, java.io.Externalizable, java.lang.Cloneable, org.omg.CORBA.portable.IDLEntity
All you need to know:
UUID u = new UUID();
| Modifier and Type | Field and Description |
|---|---|
long |
clockSeqAndNode
The clock sequence and node field of the UUID.
|
long |
time
The time field of the UUID.
|
| Constructor and Description |
|---|
TimeUuid()
Constructor for UUID.
|
TimeUuid(java.lang.CharSequence s)
Parses a textual representation of a UUID.
|
TimeUuid(long time,
long clockSeqAndNode)
Constructor for UUID.
|
TimeUuid(TimeUuid u)
Copy constructor for UUID.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Clones this UUID.
|
int |
compareTo(TimeUuid t)
Compares this UUID to another Object.
|
boolean |
equals(java.lang.Object obj)
Compares two Objects for equality.
|
long |
getClockSeqAndNode()
Returns the clock and node field of the UUID (lower 64 bits).
|
long |
getTime()
Returns the time field of the UUID (upper 64 bits).
|
int |
hashCode()
Returns a hash code of this UUID.
|
static TimeUuid |
nilUUID()
Returns the nil UUID (a UUID whose values are both set to zero).
|
static TimeUuid |
randomUUID() |
void |
readExternal(java.io.ObjectInput in)
Tweaked Serialization routine.
|
java.lang.Appendable |
toAppendable(java.lang.Appendable a)
Appends a String representation of this object to the given
Appendable object. |
java.lang.String |
toString()
Returns this UUID as a String.
|
java.lang.StringBuffer |
toStringBuffer(java.lang.StringBuffer in)
Appends a String representation of this to the given
StringBuffer or
creates a new one if none is given. |
void |
writeExternal(java.io.ObjectOutput out)
Tweaked Serialization routine.
|
public long time
public long clockSeqAndNode
public TimeUuid()
TimeUuidFactory.newTime(),
TimeUuidFactory.getClockSeqAndNode()public TimeUuid(long time,
long clockSeqAndNode)
long values.time - the upper 64 bitsclockSeqAndNode - the lower 64 bitspublic TimeUuid(TimeUuid u)
u - the UUID, may not be nullpublic TimeUuid(java.lang.CharSequence s)
No validation is performed. If the CharSequence is shorter than 36 characters,
ArrayIndexOutOfBoundsExceptions will be thrown.
s - the CharSequence, may not be nullpublic static TimeUuid randomUUID()
public int compareTo(TimeUuid t)
ClassCastException if
the other Object is not an instance of the UUID class. Returns a value
smaller than zero if the other UUID is "larger" than this UUID and a value
larger than zero if the other UUID is "smaller" than this UUID.compareTo in interface java.lang.Comparable<TimeUuid>t - the other UUID, may not be nullComparable.compareTo(java.lang.Object)public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal in interface java.io.Externalizablejava.io.IOExceptionpublic final java.lang.String toString()
toString in class java.lang.ObjectnullObject.toString(),
toAppendable(Appendable)public java.lang.StringBuffer toStringBuffer(java.lang.StringBuffer in)
StringBuffer or
creates a new one if none is given.in - the StringBuffer to append to, may be nullnulltoAppendable(Appendable)public java.lang.Appendable toAppendable(java.lang.Appendable a)
Appendable object.
For reasons I'll probably never understand, Sun has decided to have a number of I/O classes implement
Appendable which forced them to destroy an otherwise nice and simple interface with IOExceptions.
I decided to ignore any possible IOExceptions in this method.
a - the Appendable object, may be nullStringBuilder if a is nullpublic int hashCode()
hashCode in class java.lang.Objectint representing the hash codeObject.hashCode()public java.lang.Object clone()
clone in class java.lang.Objectnullpublic final long getTime()
public final long getClockSeqAndNode()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the Object to compare this UUID with, may be nulltrue if the other Object is equal to this UUID,
false if notObject.equals(Object)public static TimeUuid nilUUID()
Starting with version 2.0, this method does return a new UUID instance every time it is called. Earlier versions returned one instance. This has now been changed because this UUID has public, non-final instance fields. Returning a new instance is therefore more safe.
null