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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeMapbuild()An immutable object that is created from the properties that have been set on the builder.<T> TcomputeIfAbsent(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.AttributeMap.Buildercopy()A shallow copy of this object created by building an immutable T and then transforming it back to a builder.<T> Tget(AttributeMap.Key<T> key)Get the value for the provided key.<T> AttributeMap.Builderput(AttributeMap.Key<T> key, T value)Add a mapping between the provided key and value.AttributeMap.BuilderputAll(Map<? extends AttributeMap.Key<?>,?> attributes)Adds all the attributes from the map provided.AttributeMap.BuilderputAll(AttributeMap attributes)Put all of the attributes from the provided map into this one.<T> AttributeMap.BuilderputLazy(AttributeMap.Key<T> key, AttributeMap.LazyValue<T> lazyValue)Add a mapping between the provided key and value provider.<T> AttributeMap.BuilderputLazyIfAbsent(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
-
-
-
Method Detail
-
get
public <T> T get(AttributeMap.Key<T> key)
Get the value for the provided key.
-
computeIfAbsent
public <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. Returns the value.
-
put
public <T> AttributeMap.Builder put(AttributeMap.Key<T> key, T value)
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
public AttributeMap.Builder putAll(Map<? extends AttributeMap.Key<?>,?> attributes)
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
public AttributeMap.Builder putAll(AttributeMap attributes)
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
public AttributeMap build()
Description copied from interface:SdkBuilderAn immutable object that is created from the properties that have been set on the builder.- Specified by:
buildin interfaceBuildable- Specified by:
buildin interfaceSdkBuilder<AttributeMap.Builder,AttributeMap>- Returns:
- an instance of T
-
copy
public AttributeMap.Builder copy()
Description copied from interface:CopyableBuilderA shallow copy of this object created by building an immutable T and then transforming it back to a builder.- Specified by:
copyin interfaceCopyableBuilder<AttributeMap.Builder,AttributeMap>- Returns:
- a copy of this object
-
-