public class DD128bTraceId extends DDTraceId
It contains parsing and formatting to string for both decimal and hexadecimal representations. The string representations are either kept from parsing, or generated on demand and cached.
DD128bTraceId can represent either a 128-bit TraceId or a 64-bit TraceId. For 128-bit
TraceId, highOrderBits contains a 32-bit timestamp store on the 32 higher bits and
lowOrderBits contains a unique and random 64-bit id. For 64-bit TraceId, highOrderBits is set to 0 and lowOrderBits contains a unique and random
63-bit id.
| Modifier and Type | Field and Description |
|---|---|
static DD128bTraceId |
ZERO |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static DD128bTraceId |
from(long highOrderBits,
long lowOrderBits)
Create a new 128-bit
DD128bTraceId from the given longs interpreted as high
order and low order bits of the 128-bit id. |
static DD128bTraceId |
fromHex(String s)
Create a new 128-bit
DD128bTraceId from the given hexadecimal String
representation. |
static DD128bTraceId |
fromHex(String s,
int start,
int length,
boolean lowerCaseOnly)
Create a new 128-bit
DD128bTraceId from the given hexadecimal String
representation. |
int |
hashCode() |
String |
toHexString()
Returns the lower-case zero-padded 32 hexadecimal characters
String representation of
the DD128bTraceId. |
String |
toHexStringPadded(int size)
Returns the lower-case zero-padded
hexadecimal String representation of
the DDTraceId. |
long |
toHighOrderLong()
Returns the high-order 64 bits of 128-bit
DDTraceId as un unsigned long. |
long |
toLong()
Returns the low-order 64 bits of the
DDTraceId as an unsigned long. |
String |
toString()
|
public static final DD128bTraceId ZERO
public static DD128bTraceId from(long highOrderBits, long lowOrderBits)
DD128bTraceId from the given longs interpreted as high
order and low order bits of the 128-bit id.highOrderBits - A long representing the high-order bits of the DD128bTraceId.lowOrderBits - A long representing the random id low-order bits.public static DD128bTraceId fromHex(String s) throws NumberFormatException
DD128bTraceId from the given hexadecimal String
representation.s - The hexadecimal String representation to parse (a 32 lower-case hexadecimal
characters maximum).NumberFormatException - If the hexadecimal String representation is not valid.public static DD128bTraceId fromHex(String s, int start, int length, boolean lowerCaseOnly) throws NumberFormatException
DD128bTraceId from the given hexadecimal String
representation.s - The string containing the hexadecimal String representation to parse (32 lower
or higher-case hexadecimal characters maximum).start - The start index of the hexadecimal String representation to parse.length - The length of the hexadecimal String representation to parse.lowerCaseOnly - Whether the hexadecimal characters to parse are lower-case only or not.NumberFormatException - If the hexadecimal String representation is not valid.public String toHexString()
String representation of
the DD128bTraceId.toHexString in class DDTraceIdString representation of the
DD128bTraceId instance.public String toHexStringPadded(int size)
DDTraceIdhexadecimal String representation of
the DDTraceId. The size will be rounded up to 16 or 32
characters. This hexadecimal String will not be cached.toHexStringPadded in class DDTraceIdsize - The size in characters of the zero-padded String (rounded up to 16
or 32).String representation representation of
the DDTraceId instance.public long toLong()
DDTraceIdDDTraceId as an unsigned long. This means
that values larger than Long.MAX_VALUE will be represented as negative numbers.public long toHighOrderLong()
DDTraceIdDDTraceId as un unsigned long. This
means that values larger than Long.MAX_VALUE will be represented as negative numbers.toHighOrderLong in class DDTraceIdDDTraceId as an unsigned long,
0 for 64-bit DDTraceId only.