@Immutable public final class TraceFlags extends Object
spans. These determine features such as whether a Span should be traced. It is
implemented as a bitmask.| Modifier and Type | Class and Description |
|---|---|
static class |
TraceFlags.Builder
Builder class for
TraceFlags. |
| Modifier and Type | Method and Description |
|---|---|
static TraceFlags.Builder |
builder()
Returns a new
TraceFlags.Builder with default options. |
static TraceFlags.Builder |
builder(TraceFlags traceFlags)
Returns a new
TraceFlags.Builder with all given options set. |
void |
copyBytesTo(byte[] dest,
int destOffset)
Copies the byte representations of the
TraceFlags into the dest beginning at
the destOffset offset. |
void |
copyLowerBase16To(char[] dest,
int destOffset)
Copies the lowercase base16 representations of the
TraceId into the dest
beginning at the destOffset offset. |
boolean |
equals(Object obj) |
static TraceFlags |
fromByte(byte src)
Returns a
TraceFlags whose representation is src. |
static TraceFlags |
fromLowerBase16(CharSequence src,
int srcOffset)
Returns a
TraceOption built from a lowercase base16 representation. |
byte |
getByte()
Returns the one byte representation of the
TraceFlags. |
static TraceFlags |
getDefault()
Returns the default
TraceFlags. |
static int |
getSize()
Returns the size in bytes of the
TraceFlags. |
int |
hashCode() |
boolean |
isSampled()
Returns a boolean indicating whether this
Span is part of a sampled trace and data
should be exported to a persistent store. |
String |
toLowerBase16()
Returns the lowercase base16 encoding of this
TraceFlags. |
String |
toString() |
public static int getSize()
TraceFlags.TraceFlags.public static TraceFlags getDefault()
TraceFlags.TraceFlags.public static TraceFlags fromByte(byte src)
TraceFlags whose representation is src.src - the byte representation of the TraceFlags.TraceFlags whose representation is src.public static TraceFlags fromLowerBase16(CharSequence src, int srcOffset)
TraceOption built from a lowercase base16 representation.src - the lowercase base16 representation.srcOffset - the offset in the buffer where the representation of the TraceFlags
begins.TraceOption built from a lowercase base16 representation.NullPointerException - if src is null.IllegalArgumentException - if src.length is not 2 * TraceOption.SIZE OR
if the str has invalid characters.public byte getByte()
TraceFlags.TraceFlags.public void copyBytesTo(byte[] dest,
int destOffset)
TraceFlags into the dest beginning at
the destOffset offset.
Equivalent with (but faster because it avoids any new allocations):
System.arraycopy(getBytes(), 0, dest, destOffset, TraceFlags.getSize());
dest - the destination buffer.destOffset - the starting offset in the destination buffer.NullPointerException - if dest is null.IndexOutOfBoundsException - if destOffset+TraceFlags.getSize() is greater than
dest.length.public void copyLowerBase16To(char[] dest,
int destOffset)
TraceId into the dest
beginning at the destOffset offset.dest - the destination buffer.destOffset - the starting offset in the destination buffer.IndexOutOfBoundsException - if destOffset + 2 is greater than dest.length.public String toLowerBase16()
TraceFlags.TraceFlags.public static TraceFlags.Builder builder()
TraceFlags.Builder with default options.Builder with default options.public static TraceFlags.Builder builder(TraceFlags traceFlags)
TraceFlags.Builder with all given options set.traceFlags - the given options set.Builder with all given options set.public boolean isSampled()
Span is part of a sampled trace and data
should be exported to a persistent store.