public class UID extends java.lang.Object implements ID
The identifier is composed of:
[ time ] - [ counter ]
Numbers are converted to radix(Character.MAX_RADIX) when converting to strings.
This should provide adequate uniqueness for most purposes.
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.concurrent.atomic.AtomicLong |
COUNTER
A counter for generating identity values
|
protected long |
id
The identity portion of the UID
|
private static long |
serialVersionUID |
protected long |
time
The time portion of the UID
|
| Modifier | Constructor and Description |
|---|---|
|
UID()
Construct a new UID.
|
protected |
UID(UID uid)
Copy a UID.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
asString()
Returns a UID as a string.
|
java.lang.Object |
clone()
Returns a copy of this UID.
|
boolean |
equals(java.lang.Object obj)
Checks if the given object is equal to this UID.
|
long |
getID()
Get the identity portion of this UID.
|
long |
getTime()
Get the time portion of this UID.
|
int |
hashCode()
Return the hash code of this UID.
|
java.lang.String |
toString()
Return a string representation of this UID.
|
private static final long serialVersionUID
protected static final java.util.concurrent.atomic.AtomicLong COUNTER
protected final long time
protected final long id
public UID()
protected UID(UID uid)
uid - public final long getTime()
public final long getID()
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - Object to test equality with.public java.lang.Object clone()
clone in class java.lang.Objectpublic static java.lang.String asString()