Package software.amazon.awssdk.utils
Class AttributeMap
- java.lang.Object
-
- software.amazon.awssdk.utils.AttributeMap
-
- All Implemented Interfaces:
AutoCloseable,ToCopyableBuilder<AttributeMap.Builder,AttributeMap>,SdkAutoCloseable
@SdkProtectedApi @Immutable public final class AttributeMap extends Object implements ToCopyableBuilder<AttributeMap.Builder,AttributeMap>, SdkAutoCloseable
A map fromAttributeMap.Key<T>toTthat ensures the values stored with a key matches the type associated with the key. This does not implementMapbecause it has more strict typing requirements, but aMapcan be converted to an {code AttributeMap} via the type-unsafeAttributeMapmethod. This can be used for storing configuration values (OptionKey.LOG_LEVELtoBoolean.TRUE), attaching arbitrary attributes to a request chain (RequestAttribute.CONFIGURATIONtoClientConfiguration) or similar use-cases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAttributeMap.Builderstatic classAttributeMap.Key<T>An abstract class extended by pseudo-enums defining the key for data that is stored in theAttributeMap.static interfaceAttributeMap.LazyValue<T>A value that is evaluated lazily.static interfaceAttributeMap.LazyValueSourceA source for other values, provided to aAttributeMap.LazyValuewhen the value is resolved.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AttributeMap.Builderbuilder()voidclose()<T> booleancontainsKey(AttributeMap.Key<T> typedKey)Return true if the provided key is configured in this map.AttributeMapcopy()static AttributeMapempty()booleanequals(Object obj)<T> Tget(AttributeMap.Key<T> key)Get the value associated with the provided key from this map.inthashCode()AttributeMapmerge(AttributeMap lowerPrecedence)Merges two AttributeMaps into one.AttributeMap.BuildertoBuilder()Take this object and create a builder that contains all of the current property values of this object.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
containsKey
public <T> boolean containsKey(AttributeMap.Key<T> typedKey)
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
public <T> T get(AttributeMap.Key<T> key)
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
public AttributeMap merge(AttributeMap lowerPrecedence)
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
public static AttributeMap empty()
-
close
public void close()
Description copied from interface:SdkAutoCloseable- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
copy
public AttributeMap copy()
-
toBuilder
public AttributeMap.Builder toBuilder()
Description copied from interface:ToCopyableBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToCopyableBuilder<AttributeMap.Builder,AttributeMap>- Returns:
- a builder for type T
-
builder
public static AttributeMap.Builder builder()
-
-