Package software.amazon.awssdk.utils
Class AttributeMap
java.lang.Object
software.amazon.awssdk.utils.AttributeMap
- All Implemented Interfaces:
AutoCloseable
,ToCopyableBuilder<AttributeMap.Builder,
,AttributeMap> SdkAutoCloseable
@Immutable
public final class AttributeMap
extends Object
implements ToCopyableBuilder<AttributeMap.Builder,AttributeMap>, SdkAutoCloseable
A map from
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static class
An abstract class extended by pseudo-enums defining the key for data that is stored in theAttributeMap
.static interface
A value that is evaluated lazily.static interface
A source for other values, provided to aAttributeMap.LazyValue
when the value is resolved. -
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeMap.Builder
builder()
void
close()
<T> boolean
containsKey
(AttributeMap.Key<T> typedKey) Return true if the provided key is configured in this map.copy()
static AttributeMap
empty()
boolean
<T> T
get
(AttributeMap.Key<T> key) Get the value associated with the provided key from this map.int
hashCode()
merge
(AttributeMap lowerPrecedence) Merges two AttributeMaps into one.Take this object and create a builder that contains all of the current property values of this object.toString()
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
containsKey
Return true if the provided key is configured in this map. Useful for differentiating between whether the provided key was not configured in the map or if it is configured, but its value is null. -
get
Get the value associated with the provided key from this map. This will return null if the value is not set or if the value stored is null. These cases can be disambiguated usingcontainsKey(Key)
. -
merge
Merges two AttributeMaps into one. This object is given higher precedence then the attributes passed in as a parameter.- Parameters:
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.- Returns:
- New options with values merged.
-
empty
-
close
public void close()Description copied from interface:SdkAutoCloseable
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-
toString
-
equals
-
hashCode
public int hashCode() -
copy
-
toBuilder
Description copied from interface:ToCopyableBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToCopyableBuilder<AttributeMap.Builder,
AttributeMap> - Returns:
- a builder for type T
-
builder
-