public class UID extends Object implements Serializable, Cloneable
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.
| 限定符和类型 | 字段和说明 |
|---|---|
protected static AtomicLong |
COUNTER
A counter for generating identity values
|
protected long |
id
The identity portion of the UID
|
protected long |
time
The time portion of the UID
|
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
asString()
Returns a UID as a string.
|
Object |
clone()
Returns a copy of this UID.
|
boolean |
equals(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.
|
String |
toString()
Return a string representation of this UID.
|
protected static final 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 String toString()
public int hashCode()
public boolean equals(Object obj)
public Object clone()
public static String asString()
Copyright © 2020. All rights reserved.