com.aliyun.openservices.shade.io.opentelemetry.api.baggage.ImmutableBaggage Maven / Gradle / Ivy
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package com.aliyun.openservices.shade.com.aliyun.openservices.shade.io.opentelemetry.api.baggage;
import com.aliyun.openservices.shade.com.aliyun.openservices.shade.io.opentelemetry.api.internal.ImmutableKeyValuePairs;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Immutable
final class ImmutableBaggage extends ImmutableKeyValuePairs
implements Baggage {
private static final Baggage EMPTY = new ImmutableBaggage.Builder().build();
private ImmutableBaggage(Object[] data) {
super(data, Comparator.naturalOrder());
}
static Baggage empty() {
return EMPTY;
}
static BaggageBuilder builder() {
return new Builder();
}
@Nullable
@Override
public String getEntryValue(String entryKey) {
BaggageEntry entry = get(entryKey);
return entry != null ? entry.getValue() : null;
}
@Override
public BaggageBuilder toBuilder() {
return new Builder(new ArrayList<>(data()));
}
private static Baggage sortAndFilterToBaggage(Object[] data) {
return new ImmutableBaggage(data);
}
// TODO: Migrate to AutoValue.Builder
// @AutoValue.Builder
static class Builder implements BaggageBuilder {
private final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy