Interface SdkBuilder<B extends SdkBuilder<B,​T>,​T>

  • Type Parameters:
    B - the builder type (this)
    T - the type that the builder will build
    All Superinterfaces:
    Buildable
    All Known Subinterfaces:
    CopyableBuilder<B,​T>
    All Known Implementing Classes:
    AttributeMap.Builder, RefreshResult.Builder

    public interface SdkBuilder<B extends SdkBuilder<B,​T>,​T>
    extends Buildable
    A mutable object that can be used to create an immutable object of type T.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default B applyMutation​(Consumer<B> mutator)
      A convenience operator that takes something that will mutate the builder in some way and allows inclusion of it in chaining operations.
      T build()
      An immutable object that is created from the properties that have been set on the builder.
    • Method Detail

      • build

        T build()
        An immutable object that is created from the properties that have been set on the builder.
        Specified by:
        build in interface Buildable
        Returns:
        an instance of T
      • applyMutation

        default B applyMutation​(Consumer<B> mutator)
        A convenience operator that takes something that will mutate the builder in some way and allows inclusion of it in chaining operations. For example instead of:
        
         Builder builder = ClassBeingBuilt.builder();
         builder = Util.addSomeDetailToTheBuilder(builder);
         ClassBeingBuilt clz = builder.build();
         

        This can be done in a statement:

        
         ClassBeingBuilt = ClassBeingBuilt.builder().applyMutation(Util::addSomeDetailToTheBuilder).build();
         
        Parameters:
        mutator - the function that mutates the builder
        Returns:
        B the mutated builder instance