Package io.opentelemetry.api.common
Class ArrayBackedAttributes
- java.lang.Object
-
- io.opentelemetry.api.internal.ImmutableKeyValuePairs<AttributeKey<?>,java.lang.Object>
-
- io.opentelemetry.api.common.ArrayBackedAttributes
-
- All Implemented Interfaces:
Attributes
@Immutable final class ArrayBackedAttributes extends ImmutableKeyValuePairs<AttributeKey<?>,java.lang.Object> implements Attributes
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static Attributes
EMPTY
private static java.util.Comparator<AttributeKey<?>>
KEY_COMPARATOR_FOR_CONSTRUCTION
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
ArrayBackedAttributes(java.lang.Object[] data)
Only use this constructor if you can guarantee that the data has been de-duped, sorted by key and contains no null values or null/empty keys.private
ArrayBackedAttributes(java.lang.Object[] data, java.util.Comparator<AttributeKey<?>> keyComparator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
get(AttributeKey<T> key)
Returns the value for the givenAttributeKey
, ornull
if not found.(package private) static Attributes
sortAndFilterToAttributes(java.lang.Object... data)
AttributesBuilder
toBuilder()
Returns a newAttributesBuilder
instance populated with the data of thisAttributes
.-
Methods inherited from class io.opentelemetry.api.internal.ImmutableKeyValuePairs
asMap, data, equals, forEach, get, getData, hashCode, isEmpty, size, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.api.common.Attributes
asMap, forEach, isEmpty, size
-
-
-
-
Field Detail
-
KEY_COMPARATOR_FOR_CONSTRUCTION
private static final java.util.Comparator<AttributeKey<?>> KEY_COMPARATOR_FOR_CONSTRUCTION
-
EMPTY
static final Attributes EMPTY
-
-
Constructor Detail
-
ArrayBackedAttributes
private ArrayBackedAttributes(java.lang.Object[] data, java.util.Comparator<AttributeKey<?>> keyComparator)
-
ArrayBackedAttributes
ArrayBackedAttributes(java.lang.Object[] data)
Only use this constructor if you can guarantee that the data has been de-duped, sorted by key and contains no null values or null/empty keys.- Parameters:
data
- the raw data
-
-
Method Detail
-
toBuilder
public AttributesBuilder toBuilder()
Description copied from interface:Attributes
Returns a newAttributesBuilder
instance populated with the data of thisAttributes
.- Specified by:
toBuilder
in interfaceAttributes
-
get
@Nullable public <T> T get(AttributeKey<T> key)
Description copied from interface:Attributes
Returns the value for the givenAttributeKey
, ornull
if not found.- Specified by:
get
in interfaceAttributes
-
sortAndFilterToAttributes
static Attributes sortAndFilterToAttributes(java.lang.Object... data)
-
-