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 Details

    • 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 to putLazy(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: SdkBuilder
      An immutable object that is created from the properties that have been set on the builder.
      Specified by:
      build in interface Buildable
      Specified by:
      build in interface SdkBuilder<AttributeMap.Builder,AttributeMap>
      Returns:
      an instance of T
    • copy

      public AttributeMap.Builder 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 interface CopyableBuilder<AttributeMap.Builder,AttributeMap>
      Returns:
      a copy of this object