@Immutable public final class AttributeMap extends Object implements ToCopyableBuilder<AttributeMap.Builder,AttributeMap>, SdkAutoCloseable
AttributeMap.Key<T>
to T
that ensures the values stored with a key matches the type associated with
the key. This does not implement Map
because it has more strict typing requirements, but a Map
can be
converted
to an {code AttributeMap} via the type-unsafe AttributeMap
method.
This can be used for storing configuration values (OptionKey.LOG_LEVEL
to Boolean.TRUE
), attaching
arbitrary attributes to a request chain (RequestAttribute.CONFIGURATION
to ClientConfiguration
) or similar
use-cases.Modifier and Type | Class and Description |
---|---|
static class |
AttributeMap.Builder |
static class |
AttributeMap.Key<T>
An abstract class extended by pseudo-enums defining the key for data that is stored in the
AttributeMap . |
Modifier and Type | Method and Description |
---|---|
static AttributeMap.Builder |
builder() |
void |
close() |
<T> boolean |
containsKey(AttributeMap.Key<T> typedKey)
Return true if the provided key is configured in this map.
|
AttributeMap |
copy() |
static AttributeMap |
empty() |
boolean |
equals(Object obj) |
<T> T |
get(AttributeMap.Key<T> key)
Get the value associated with the provided key from this map.
|
int |
hashCode() |
AttributeMap |
merge(AttributeMap lowerPrecedence)
Merges two AttributeMaps into one.
|
AttributeMap.Builder |
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
copy
public <T> boolean containsKey(AttributeMap.Key<T> typedKey)
public <T> T get(AttributeMap.Key<T> key)
containsKey(Key)
.public AttributeMap merge(AttributeMap lowerPrecedence)
lowerPrecedence
- Options to merge into 'this' AttributeMap object. Any attribute already specified in 'this' object
will be left as is since it has higher precedence.public static AttributeMap empty()
public AttributeMap copy()
public void close()
SdkAutoCloseable
close
in interface AutoCloseable
close
in interface SdkAutoCloseable
public AttributeMap.Builder toBuilder()
ToCopyableBuilder
toBuilder
in interface ToCopyableBuilder<AttributeMap.Builder,AttributeMap>
public static AttributeMap.Builder builder()
Copyright © 2020. All rights reserved.