Package io.opencensus.trace
Class Tracestate.Builder
- java.lang.Object
-
- io.opencensus.trace.Tracestate.Builder
-
- Enclosing class:
- Tracestate
@ExperimentalApi public static final class Tracestate.Builder extends java.lang.Object
Builder class forMessageEvent
.- Since:
- 0.16
-
-
Field Summary
Fields Modifier and Type Field Description private static Tracestate
EMPTY
private java.util.ArrayList<Tracestate.Entry>
entries
private Tracestate
parent
-
Constructor Summary
Constructors Modifier Constructor Description private
Builder(Tracestate parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tracestate
build()
Builds a TraceState by adding the entries to the parent in front of the key-value pairs list and removing duplicate entries.Tracestate.Builder
remove(java.lang.String key)
Removes theEntry
that has the givenkey
if it is present.Tracestate.Builder
set(java.lang.String key, java.lang.String value)
Adds or updates theEntry
that has the givenkey
if it is present.
-
-
-
Field Detail
-
parent
private final Tracestate parent
-
entries
@Nullable private java.util.ArrayList<Tracestate.Entry> entries
-
EMPTY
private static final Tracestate EMPTY
-
-
Constructor Detail
-
Builder
private Builder(Tracestate parent)
-
-
Method Detail
-
set
public Tracestate.Builder set(java.lang.String key, java.lang.String value)
Adds or updates theEntry
that has the givenkey
if it is present. The newEntry
will always be added in the front of the list of entries.- Parameters:
key
- the key for theEntry
to be added.value
- the value for theEntry
to be added.- Returns:
- this.
- Since:
- 0.16
-
remove
public Tracestate.Builder remove(java.lang.String key)
Removes theEntry
that has the givenkey
if it is present.- Parameters:
key
- the key for theEntry
to be removed.- Returns:
- this.
- Since:
- 0.16
-
build
public Tracestate build()
Builds a TraceState by adding the entries to the parent in front of the key-value pairs list and removing duplicate entries.- Returns:
- a TraceState with the new entries.
- Since:
- 0.16
-
-