ContextMetadata

public abstract class ContextMetadata extends Metadata

Immutable Metadata implementation intended for use in nested contexts. Scope metadata can be concatenated to inherit metadata from a parent context. This class is only expected to be needed by implementations of ScopedLoggingContext and should not be considered a stable API.

See also

<a href="https://github.com/google/flogger/blob/cb9e836a897d36a78309ee8badf5cad4e6a2d3d8/api/src/main/java/com/google/common/flogger/context/ContextMetadata.java">

Original Java code of Google Flogger

Types

Link copied to clipboard
public final class Builder
A builder to collect metadata key/values pairs in order.

Functions

Link copied to clipboard
Returns a new ScopeMetadata builder.
Link copied to clipboard
public abstract ContextMetadata concatenate(ContextMetadata metadata)
Concatenates the given context metadata after this instance.
Link copied to clipboard
public FloggerMetadataKey<? extends Object> getKey(int n)
Returns the key for the Nth piece of metadata.
Link copied to clipboard
public Object getValue(int n)
Returns the non-null value for the Nth piece of metadata.
Link copied to clipboard
public static ContextMetadata none()
Returns the empty ScopeMetadata.
Link copied to clipboard
public static ContextMetadata singleton<T>(FloggerMetadataKey<T> key, T value)
Returns a space efficient ScopeMetadata containing a single value.

Inherited functions

Link copied to clipboard
public static Metadata empty()
Returns an immutable Metadata that has no items.
Link copied to clipboard
@Nullable()
public abstract @Nullable() T findValue<T>(FloggerMetadataKey<T> key)
Returns the first value for the given single valued metadata key, or null if it does not exist.
Link copied to clipboard
public abstract int size()
Returns the number of key/value pairs for this instance.