Class StateUpdateBuilder

java.lang.Object
com.commercetools.api.models.state.StateUpdateBuilder
All Implemented Interfaces:
Builder<StateUpdate>

public class StateUpdateBuilder extends Object implements Builder<StateUpdate>
StateUpdateBuilder
Example to create an instance using the builder pattern

     StateUpdate stateUpdate = StateUpdate.builder()
             .version(0.3)
             .plusActions(actionsBuilder -> actionsBuilder)
             .build()
 
  • Constructor Details

    • StateUpdateBuilder

      public StateUpdateBuilder()
  • Method Details

    • version

      public StateUpdateBuilder version(Long version)

      Expected version of the State on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • actions

      public StateUpdateBuilder actions(StateUpdateAction... actions)

      Update actions to be performed on the State.

      Parameters:
      actions - value to be set
      Returns:
      Builder
    • actions

      public StateUpdateBuilder actions(List<StateUpdateAction> actions)

      Update actions to be performed on the State.

      Parameters:
      actions - value to be set
      Returns:
      Builder
    • plusActions

      public StateUpdateBuilder plusActions(StateUpdateAction... actions)

      Update actions to be performed on the State.

      Parameters:
      actions - value to be set
      Returns:
      Builder
    • plusActions

      Update actions to be performed on the State.

      Parameters:
      builder - function to build the actions value
      Returns:
      Builder
    • withActions

      Update actions to be performed on the State.

      Parameters:
      builder - function to build the actions value
      Returns:
      Builder
    • getVersion

      public Long getVersion()

      Expected version of the State on which the changes should be applied. If the expected version does not match the actual version, a ConcurrentModification error will be returned.

      Returns:
      version
    • getActions

      public List<StateUpdateAction> getActions()

      Update actions to be performed on the State.

      Returns:
      actions
    • build

      public StateUpdate build()
      builds StateUpdate with checking for non-null required values
      Specified by:
      build in interface Builder<StateUpdate>
      Returns:
      StateUpdate
    • buildUnchecked

      public StateUpdate buildUnchecked()
      builds StateUpdate without checking for non-null required values
      Returns:
      StateUpdate
    • of

      public static StateUpdateBuilder of()
      factory method for an instance of StateUpdateBuilder
      Returns:
      builder
    • of

      public static StateUpdateBuilder of(StateUpdate template)
      create builder for StateUpdate instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder