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 inthashCodeprivate java.lang.Stringkeyprivate byte[]keyUtf8private AttributeTypetype
-
Constructor Summary
Constructors Modifier Constructor Description privateInternalAttributeKeyImpl(AttributeType type, java.lang.String key)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private intbuildHashCode()private static intbuildHashCode(AttributeType type, java.lang.String key)static <T> AttributeKey<T>create(java.lang.String key, AttributeType type)booleanequals(java.lang.Object o)java.lang.StringgetKey()Returns the underlying String representation of the key.byte[]getKeyUtf8()Returns the key, encoded as UTF-8 bytes.AttributeTypegetType()Returns the type of attribute for this key.inthashCode()java.lang.StringtoString()
-
-
-
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:AttributeKeyReturns the type of attribute for this key. Useful for building switch statements.- Specified by:
getTypein interfaceAttributeKey<T>
-
getKey
public java.lang.String getKey()
Description copied from interface:AttributeKeyReturns the underlying String representation of the key.- Specified by:
getKeyin interfaceAttributeKey<T>
-
getKeyUtf8
public byte[] getKeyUtf8()
Returns the key, encoded as UTF-8 bytes.
-
equals
public boolean equals(@Nullable java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
buildHashCode
private int buildHashCode()
-
buildHashCode
private static int buildHashCode(AttributeType type, java.lang.String key)
-
-