MetadataHandler

public abstract class MetadataHandler<C>

Callback API for logger backend implementations to handle metadata keys/values. The API methods will be called once for each distinct key, in encounter order. Different methods are called depending on whether the key is repeatable or not.

It is expected that the most convenient way to construct a metadata handler is via the Builder class, which lets keys be individually mapped to callbacks, however the class can also just be extended to implement alternate/custom behavior.

Parameters

<C>

the arbitrary context type.

See also

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

Original Java code of Google Flogger

Constructors

Link copied to clipboard
public void MetadataHandler()

Types

Link copied to clipboard
public final class Builder<C>
Builder for a map-based MetadataHandler which allows handlers to be associated with individual callbacks.
Link copied to clipboard
public interface RepeatedValueHandler<T, C>
API for handling repeated metadata key/values in a single callback.
Link copied to clipboard
public interface ValueHandler<T, C>
API for handling metadata key/value pairs individually.

Functions

Link copied to clipboard
Returns a builder for a handler with the specified default callback.
Link copied to clipboard
protected abstract void handle<T>(FloggerMetadataKey<T> key, T value, C context)
Handles a single metadata key/value mapping.
Link copied to clipboard
protected void handleRepeated<T>(FloggerMetadataKey<T> key, Iterator<T> values, C context)
Handles values for a repeatable metadata key.