java.lang.Object
com.commercetools.history.models.change_history.RecordBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<Record>

public class RecordBuilder extends Object implements io.vrap.rmf.base.client.Builder<Record>
RecordBuilder
Example to create an instance using the builder pattern

     Record record = Record.builder()
             .version(1)
             .previousVersion(1)
             .type("{type}")
             .modifiedBy(modifiedByBuilder -> modifiedByBuilder)
             .modifiedAt("{modifiedAt}")
             .label(labelBuilder -> labelBuilder)
             .previousLabel(previousLabelBuilder -> previousLabelBuilder)
             .plusChanges(changesBuilder -> changesBuilder)
             .resource(resourceBuilder -> resourceBuilder)
             .plusStores(storesBuilder -> storesBuilder)
             .withoutChanges(true)
             .build()
 
  • Constructor Details

  • Method Details

    • version

      public RecordBuilder version(Integer version)

      Version of the resource after the change.

      For more information on how the version is incremented, see Optimistic Concurrency Control.

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

      public RecordBuilder previousVersion(Integer previousVersion)

      Version of the resource before the change.

      Parameters:
      previousVersion - value to be set
      Returns:
      Builder
    • type

      public RecordBuilder type(String type)

      Indicates the type of change. For creation, update, or deletion, the value is "ResourceCreated", "ResourceUpdated", or "ResourceDeleted" respectively.

      Parameters:
      type - value to be set
      Returns:
      Builder
    • modifiedBy

      Information about the user or API Client who performed the change.

      Parameters:
      builder - function to build the modifiedBy value
      Returns:
      Builder
    • withModifiedBy

      Information about the user or API Client who performed the change.

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

      public RecordBuilder modifiedBy(ModifiedBy modifiedBy)

      Information about the user or API Client who performed the change.

      Parameters:
      modifiedBy - value to be set
      Returns:
      Builder
    • modifiedAt

      public RecordBuilder modifiedAt(String modifiedAt)

      Date and time (UTC) when the change was made.

      Parameters:
      modifiedAt - value to be set
      Returns:
      Builder
    • label

      public RecordBuilder label(Label label)

      Information that describes the resource after the change.

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

      public RecordBuilder label(Function<LabelBuilder,io.vrap.rmf.base.client.Builder<? extends Label>> builder)

      Information that describes the resource after the change.

      Parameters:
      builder - function to build the label value
      Returns:
      Builder
    • previousLabel

      public RecordBuilder previousLabel(Label previousLabel)

      Information that describes the resource before the change.

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

      public RecordBuilder previousLabel(Function<LabelBuilder,io.vrap.rmf.base.client.Builder<? extends Label>> builder)

      Information that describes the resource before the change.

      Parameters:
      builder - function to build the previousLabel value
      Returns:
      Builder
    • changes

      public RecordBuilder changes(Change... changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

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

      public RecordBuilder changes(List<Change> changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      changes - value to be set
      Returns:
      Builder
    • plusChanges

      public RecordBuilder plusChanges(Change... changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      changes - value to be set
      Returns:
      Builder
    • plusChanges

      public RecordBuilder plusChanges(Function<ChangeBuilder,io.vrap.rmf.base.client.Builder<? extends Change>> builder)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      builder - function to build the changes value
      Returns:
      Builder
    • withChanges

      public RecordBuilder withChanges(Function<ChangeBuilder,io.vrap.rmf.base.client.Builder<? extends Change>> builder)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      builder - function to build the changes value
      Returns:
      Builder
    • resource

      ResourceIdentifier of the changed resource.

      Parameters:
      builder - function to build the resource value
      Returns:
      Builder
    • withResource

      ResourceIdentifier of the changed resource.

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

      ResourceIdentifier of the changed resource.

      Parameters:
      resource - value to be set
      Returns:
      Builder
    • stores

      public RecordBuilder stores(KeyReference... stores)

      References to the Stores associated with the Change.

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

      References to the Stores associated with the Change.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      References to the Stores associated with the Change.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      References to the Stores associated with the Change.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • withStores

      References to the Stores associated with the Change.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • addStores

      References to the Stores associated with the Change.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • setStores

      References to the Stores associated with the Change.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • withoutChanges

      public RecordBuilder withoutChanges(Boolean withoutChanges)

      true if no change was detected.

      The version number of the resource can be increased even without any change in the resource.

      Parameters:
      withoutChanges - value to be set
      Returns:
      Builder
    • getVersion

      public Integer getVersion()

      Version of the resource after the change.

      For more information on how the version is incremented, see Optimistic Concurrency Control.

      Returns:
      version
    • getPreviousVersion

      Version of the resource before the change.

      Returns:
      previousVersion
    • getType

      public String getType()

      Indicates the type of change. For creation, update, or deletion, the value is "ResourceCreated", "ResourceUpdated", or "ResourceDeleted" respectively.

      Returns:
      type
    • getModifiedBy

      Information about the user or API Client who performed the change.

      Returns:
      modifiedBy
    • getModifiedAt

      Date and time (UTC) when the change was made.

      Returns:
      modifiedAt
    • getLabel

      public Label getLabel()

      Information that describes the resource after the change.

      Returns:
      label
    • getPreviousLabel

      Information that describes the resource before the change.

      Returns:
      previousLabel
    • getChanges

      public List<Change> getChanges()

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Returns:
      changes
    • getResource

      ResourceIdentifier of the changed resource.

      Returns:
      resource
    • getStores

      References to the Stores associated with the Change.

      Returns:
      stores
    • getWithoutChanges

      true if no change was detected.

      The version number of the resource can be increased even without any change in the resource.

      Returns:
      withoutChanges
    • build

      public Record build()
      builds Record with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<Record>
      Returns:
      Record
    • buildUnchecked

      builds Record without checking for non-null required values
      Returns:
      Record
    • of

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

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