Package software.amazon.awssdk.utils
Class AttributeMap.Builder
java.lang.Object
software.amazon.awssdk.utils.AttributeMap.Builder
- All Implemented Interfaces:
Buildable
,CopyableBuilder<AttributeMap.Builder,
,AttributeMap> SdkBuilder<AttributeMap.Builder,
AttributeMap>
- Enclosing class:
AttributeMap
public static final class AttributeMap.Builder
extends Object
implements CopyableBuilder<AttributeMap.Builder,AttributeMap>
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
An immutable object that is created from the properties that have been set on the builder.<T> T
computeIfAbsent
(AttributeMap.Key<T> key, Supplier<T> valueIfAbsent) Add a mapping between the provided key and value, if the current value for the key is null.copy()
A shallow copy of this object created by building an immutable T and then transforming it back to a builder.<T> T
get
(AttributeMap.Key<T> key) Get the value for the provided key.put
(AttributeMap.Key<T> key, T value) Add a mapping between the provided key and value.putAll
(Map<? extends AttributeMap.Key<?>, ?> attributes) Adds all the attributes from the map provided.putAll
(AttributeMap attributes) Put all of the attributes from the provided map into this one.putLazy
(AttributeMap.Key<T> key, AttributeMap.LazyValue<T> lazyValue) Add a mapping between the provided key and value provider.putLazyIfAbsent
(AttributeMap.Key<T> key, AttributeMap.LazyValue<T> lazyValue) Equivalent toputLazy(Key, LazyValue)
, but does not assign the value if there is already a non-null value assigned for the provided key.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
Method Details
-
get
Get the value for the provided key. -
computeIfAbsent
Add a mapping between the provided key and value, if the current value for the key is null. Returns the value. -
put
Add a mapping between the provided key and value. -
putLazy
public <T> AttributeMap.Builder putLazy(AttributeMap.Key<T> key, AttributeMap.LazyValue<T> lazyValue) Add a mapping between the provided key and value provider. The lazy value will only be resolved when the value is needed. During resolution, the lazy value is provided with a value reader. The value reader will fail if the reader attempts to read its own value (directly, or indirectly through other lazy values). If a value is updated that a lazy value is depended on, the lazy value will be re-resolved the next time the lazy value is accessed. -
putLazyIfAbsent
public <T> AttributeMap.Builder putLazyIfAbsent(AttributeMap.Key<T> key, AttributeMap.LazyValue<T> lazyValue) Equivalent toputLazy(Key, LazyValue)
, but does not assign the value if there is already a non-null value assigned for the provided key. -
putAll
Adds all the attributes from the map provided. This is not type safe, and will throw an exception during creation if a value in the map is not of the correct type for its key. -
putAll
Put all of the attributes from the provided map into this one. This will resolve lazy attributes and store their value as a constant, so this should only be used when the source attributes are constants or it's okay that the values will no longer be lazy. -
build
Description copied from interface:SdkBuilder
An immutable object that is created from the properties that have been set on the builder.- Specified by:
build
in interfaceBuildable
- Specified by:
build
in interfaceSdkBuilder<AttributeMap.Builder,
AttributeMap> - Returns:
- an instance of T
-
copy
Description copied from interface:CopyableBuilder
A shallow copy of this object created by building an immutable T and then transforming it back to a builder.- Specified by:
copy
in interfaceCopyableBuilder<AttributeMap.Builder,
AttributeMap> - Returns:
- a copy of this object
-