Package io.opentelemetry.api.internal
Class InternalAttributeKeyImpl<T>
- java.lang.Object
-
- io.opentelemetry.api.internal.InternalAttributeKeyImpl<T>
-
- All Implemented Interfaces:
AttributeKey<T>
public final class InternalAttributeKeyImpl<T> extends java.lang.Object implements AttributeKey<T>
Default AttributeKey implementation which preencodes to UTF8 for OTLP export.This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Field Summary
Fields Modifier and Type Field Description private int
hashCode
private java.lang.String
key
private byte[]
keyUtf8
private AttributeType
type
-
Constructor Summary
Constructors Modifier Constructor Description private
InternalAttributeKeyImpl(AttributeType type, java.lang.String key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
buildHashCode()
private static int
buildHashCode(AttributeType type, java.lang.String key)
static <T> AttributeKey<T>
create(java.lang.String key, AttributeType type)
boolean
equals(java.lang.Object o)
java.lang.String
getKey()
Returns the underlying String representation of the key.byte[]
getKeyUtf8()
Returns the key, encoded as UTF-8 bytes.AttributeType
getType()
Returns the type of attribute for this key.int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
type
private final AttributeType type
-
key
private final java.lang.String key
-
hashCode
private final int hashCode
-
keyUtf8
@Nullable private byte[] keyUtf8
-
-
Constructor Detail
-
InternalAttributeKeyImpl
private InternalAttributeKeyImpl(AttributeType type, java.lang.String key)
-
-
Method Detail
-
create
public static <T> AttributeKey<T> create(@Nullable java.lang.String key, AttributeType type)
-
getType
public AttributeType getType()
Description copied from interface:AttributeKey
Returns the type of attribute for this key. Useful for building switch statements.- Specified by:
getType
in interfaceAttributeKey<T>
-
getKey
public java.lang.String getKey()
Description copied from interface:AttributeKey
Returns the underlying String representation of the key.- Specified by:
getKey
in interfaceAttributeKey<T>
-
getKeyUtf8
public byte[] getKeyUtf8()
Returns the key, encoded as UTF-8 bytes.
-
equals
public boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
buildHashCode
private int buildHashCode()
-
buildHashCode
private static int buildHashCode(AttributeType type, java.lang.String key)
-
-