public class DDId extends Object
It contains generation of new ids, parsing, and to string for both decimal and hex representations. The decimal string representation is either kept from parsing, or generated on demand and cached.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
static DDId |
from(long id)
Create a new
DDId from the given long interpreted as the bits of the unsigned
64 bit id. |
static DDId |
from(String s)
Create a new
DDId from the given String representation of the unsigned 64 bit
id. |
static DDId |
fromHex(String s)
Create a new
DDId from the given String hex representation of the unsigned 64
bit id. |
static DDId |
fromHexTruncatedWithOriginal(String s)
Create a new
DDId from the given String hex representation of the unsigned 64
bit (or more) id truncated to 64 bits, while retaining the original String
representation for use in headers. |
static DDId |
fromHexWithOriginal(String s)
Create a new
DDId from the given String hex representation of the unsigned 64
bit id, while retalining the original String representation for use in headers. |
int |
hashCode() |
String |
toHexString()
Returns the no zero padded hex representation, in lower case, of the unsigned 64 bit id.
|
String |
toHexStringOrOriginal()
Returns the no zero padded hex representation, in lower case, of the unsigned 64 bit id, or the
original
String used to create this DDId . |
String |
toHexStringPadded(int size)
Returns the zero padded hex representation, in lower case, of the unsigned 64 bit id.
|
long |
toLong()
Returns the id as a long representing the bits of the unsigned 64 bit id.
|
String |
toString()
Returns the decimal string representation of the unsigned 64 bit id.
|
public static DDId from(long id)
DDId
from the given long
interpreted as the bits of the unsigned
64 bit id. This means that values larger than Long.MAX_VALUE will be represented as negative
numbers.id
- long representing the bits of the unsigned 64 bit idpublic static DDId from(String s) throws NumberFormatException
DDId
from the given String
representation of the unsigned 64 bit
id.s
- String of unsigned 64 bit idNumberFormatException
public static DDId fromHex(String s) throws NumberFormatException
DDId
from the given String
hex representation of the unsigned 64
bit id.s
- String in hex of unsigned 64 bit idNumberFormatException
public static DDId fromHexWithOriginal(String s) throws NumberFormatException
DDId
from the given String
hex representation of the unsigned 64
bit id, while retalining the original String
representation for use in headers.s
- String in hex of unsigned 64 bit idNumberFormatException
public static DDId fromHexTruncatedWithOriginal(String s) throws NumberFormatException
DDId
from the given String
hex representation of the unsigned 64
bit (or more) id truncated to 64 bits, while retaining the original String
representation for use in headers.s
- String in hex of unsigned 64 bit (or more) idNumberFormatException
public String toString()
String
will be
cached.public String toHexString()
String
will NOT be cached.public String toHexStringPadded(int size)
String
will NOT be cached.size
- the size in characters of the 0 padded String (rounded up to 16 or 32)public String toHexStringOrOriginal()
String
used to create this DDId
. The hex String
will NOT be
cached.public long toLong()