All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.openservices.shade.io.opentelemetry.api.baggage.BaggageBuilder Maven / Gradle / Ivy

There is a newer version: 1.9.4.Final
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package com.aliyun.openservices.shade.com.aliyun.openservices.shade.io.opentelemetry.api.baggage;

/**
 * A builder of {@link Baggage}.
 *
 * @see Baggage#builder()
 */
public interface BaggageBuilder {

  /**
   * Adds the key/value pair and metadata regardless of whether the key is present.
   *
   * @param key the {@code String} key which will be set.
   * @param value the {@code String} value to set for the given key.
   * @param entryMetadata the {@code BaggageEntryMetadata} metadata to set for the given key.
   * @return this
   */
  BaggageBuilder put(String key, String value, BaggageEntryMetadata entryMetadata);

  /**
   * Adds the key/value pair with empty metadata regardless of whether the key is present.
   *
   * @param key the {@code String} key which will be set.
   * @param value the {@code String} value to set for the given key.
   * @return this
   */
  default BaggageBuilder put(String key, String value) {
    return put(key, value, BaggageEntryMetadata.empty());
  }

  /**
   * Removes the key if it exists.
   *
   * @param key the {@code String} key which will be removed.
   * @return this
   */
  BaggageBuilder remove(String key);

  /**
   * Creates a {@code Baggage} from this builder.
   *
   * @return a {@code Baggage} with the same entries as this builder.
   */
  Baggage build();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy