Package io.opentelemetry.api.common
Interface AttributeKey<T>
-
- Type Parameters:
T
- The type of value that can be set with the key.
- All Superinterfaces:
Comparable<AttributeKey>
@Immutable public interface AttributeKey<T> extends Comparable<AttributeKey>
This interface provides a handle for setting the values ofAttributes
. The type of value that can be set with an implementation of this key is denoted by the type parameter.Implementations MUST be immutable, as these are used as the keys to Maps.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static AttributeKey<List<Boolean>>
booleanArrayKey(String key)
Returns a new AttributeKey for List<Boolean> valued attributes.static AttributeKey<Boolean>
booleanKey(String key)
Returns a new AttributeKey for Boolean valued attributes.static AttributeKey<List<Double>>
doubleArrayKey(String key)
Returns a new AttributeKey for List<Double> valued attributes.static AttributeKey<Double>
doubleKey(String key)
Returns a new AttributeKey for Double valued attributes.String
getKey()
Returns the underlying String representation of the key.AttributeType
getType()
Returns the type of attribute for this key.static AttributeKey<List<Long>>
longArrayKey(String key)
Returns a new AttributeKey for List<Long> valued attributes.static AttributeKey<Long>
longKey(String key)
Returns a new AttributeKey for Long valued attributes.static AttributeKey<List<String>>
stringArrayKey(String key)
Returns a new AttributeKey for List<String> valued attributes.static AttributeKey<String>
stringKey(String key)
Returns a new AttributeKey for String valued attributes.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
getKey
String getKey()
Returns the underlying String representation of the key.
-
getType
@Nonnull AttributeType getType()
Returns the type of attribute for this key. Useful for building switch statements.
-
stringKey
static AttributeKey<String> stringKey(String key)
Returns a new AttributeKey for String valued attributes.
-
booleanKey
static AttributeKey<Boolean> booleanKey(String key)
Returns a new AttributeKey for Boolean valued attributes.
-
longKey
static AttributeKey<Long> longKey(String key)
Returns a new AttributeKey for Long valued attributes.
-
doubleKey
static AttributeKey<Double> doubleKey(String key)
Returns a new AttributeKey for Double valued attributes.
-
stringArrayKey
static AttributeKey<List<String>> stringArrayKey(String key)
Returns a new AttributeKey for List<String> valued attributes.
-
booleanArrayKey
static AttributeKey<List<Boolean>> booleanArrayKey(String key)
Returns a new AttributeKey for List<Boolean> valued attributes.
-
longArrayKey
static AttributeKey<List<Long>> longArrayKey(String key)
Returns a new AttributeKey for List<Long> valued attributes.
-
doubleArrayKey
static AttributeKey<List<Double>> doubleArrayKey(String key)
Returns a new AttributeKey for List<Double> valued attributes.
-
-