Package io.opentelemetry.api.trace
Class ImmutableTraceFlags
- java.lang.Object
-
- io.opentelemetry.api.trace.ImmutableTraceFlags
-
- All Implemented Interfaces:
TraceFlags
@Immutable final class ImmutableTraceFlags extends java.lang.Object implements TraceFlags
-
-
Field Summary
Fields Modifier and Type Field Description private byte
byteRep
(package private) static ImmutableTraceFlags
DEFAULT
(package private) static int
HEX_LENGTH
private java.lang.String
hexRep
private static ImmutableTraceFlags[]
INSTANCES
(package private) static ImmutableTraceFlags
SAMPLED
private static byte
SAMPLED_BIT
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableTraceFlags(byte byteRep)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte
asByte()
Returns the byte representation of thisTraceFlags
.java.lang.String
asHex()
Returns the lowercase hex (base16) representation of thisTraceFlags
.private static ImmutableTraceFlags[]
buildInstances()
(package private) static ImmutableTraceFlags
fromByte(byte traceFlagsByte)
Returns theTraceFlags
converted from the given byte representation.(package private) static ImmutableTraceFlags
fromHex(java.lang.CharSequence src, int srcOffset)
Returns theTraceFlags
converted from the given lowercase hex (base16) representation.boolean
isSampled()
java.lang.String
toString()
-
-
-
Field Detail
-
INSTANCES
private static final ImmutableTraceFlags[] INSTANCES
-
SAMPLED_BIT
private static final byte SAMPLED_BIT
- See Also:
- Constant Field Values
-
DEFAULT
static final ImmutableTraceFlags DEFAULT
-
SAMPLED
static final ImmutableTraceFlags SAMPLED
-
HEX_LENGTH
static final int HEX_LENGTH
- See Also:
- Constant Field Values
-
hexRep
private final java.lang.String hexRep
-
byteRep
private final byte byteRep
-
-
Method Detail
-
fromHex
static ImmutableTraceFlags fromHex(java.lang.CharSequence src, int srcOffset)
Description copied from interface:TraceFlags
Returns theTraceFlags
converted from the given lowercase hex (base16) representation.This may throw runtime exceptions if the input is invalid.
- Parameters:
src
- the buffer where the hex (base16) representation of theTraceFlags
is.srcOffset
- the offset int buffer.- Returns:
- the
TraceFlags
converted from the given lowercase hex (base16) representation.
-
fromByte
static ImmutableTraceFlags fromByte(byte traceFlagsByte)
Description copied from interface:TraceFlags
Returns theTraceFlags
converted from the given byte representation.- Parameters:
traceFlagsByte
- the byte representation of theTraceFlags
.- Returns:
- the
TraceFlags
converted from the given byte representation.
-
buildInstances
private static ImmutableTraceFlags[] buildInstances()
-
isSampled
public boolean isSampled()
Description copied from interface:TraceFlags
- Specified by:
isSampled
in interfaceTraceFlags
- Returns:
true
if the sampling bit is on for thisTraceFlags
, otherwise* false
.
-
asHex
public java.lang.String asHex()
Description copied from interface:TraceFlags
Returns the lowercase hex (base16) representation of thisTraceFlags
.- Specified by:
asHex
in interfaceTraceFlags
- Returns:
- the byte representation of the
TraceFlags
.
-
asByte
public byte asByte()
Description copied from interface:TraceFlags
Returns the byte representation of thisTraceFlags
.- Specified by:
asByte
in interfaceTraceFlags
- Returns:
- the byte representation of the
TraceFlags
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-