| Modifier and Type | Method and Description |
|---|---|
Baggage |
build()
Creates a
Baggage from this builder. |
Baggage.Builder |
put(String key,
String value,
EntryMetadata entryMetadata)
Adds the key/value pair and metadata regardless of whether the key is present.
|
Baggage.Builder |
remove(String key)
Removes the key if it exists.
|
Baggage.Builder |
setNoParent()
Sets the option to become a root
Baggage with no parent. |
Baggage.Builder |
setParent(Baggage parent)
Sets the parent
Baggage to use. |
Baggage.Builder |
setParent(io.grpc.Context context)
Sets the parent
Baggage to use from the specified Context. |
Baggage.Builder setParent(Baggage parent)
Baggage to use. If no parent is provided, the value of BaggageManager.getCurrentBaggage() at build() time will be used as parent, unless
setNoParent() was called.
This must be used to create a Baggage when manual Context propagation is
used.
If called multiple times, only the last specified value will be used.
parent - the Baggage used as parent, not null.NullPointerException - if parent is null.setNoParent()Baggage.Builder setParent(io.grpc.Context context)
Baggage to use from the specified Context. If no parent
Baggage is provided, the value of BaggageManager.getCurrentBaggage() at
build() time will be used as parent, unless setNoParent() was called.
If no parent Baggage is available in the specified Context, the resulting
Baggage will become a root instance, as if setNoParent() had been called.
This must be used to create a Baggage when manual Context propagation is
used.
If called multiple times, only the last specified value will be used.
context - the Context.NullPointerException - if context is null.setNoParent()Baggage.Builder setNoParent()
Baggage with no parent. If not called, the
value provided using setParent(Baggage) or otherwise BaggageManager.getCurrentBaggage() at build() time will be used as parent.Baggage.Builder put(String key, String value, EntryMetadata entryMetadata)
key - the String key which will be set.value - the String value to set for the given key.entryMetadata - the EntryMetadata associated with this Entry.Baggage.Builder remove(String key)
key - the String key which will be removed.Baggage build()
Baggage from this builder.Baggage with the same entries as this builder.