Class CustomObjectBuilder

java.lang.Object
com.commercetools.api.models.custom_object.CustomObjectBuilder
All Implemented Interfaces:
Builder<CustomObject>

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

     CustomObject customObject = CustomObject.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .container("{container}")
             .key("{key}")
             .build()
 
  • Constructor Details

    • CustomObjectBuilder

      public CustomObjectBuilder()
  • Method Details

    • id

      public CustomObjectBuilder id(String id)

      Unique identifier of the CustomObject.

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

      public CustomObjectBuilder version(Long version)

      Current version of the CustomObject.

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

      public CustomObjectBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the CustomObject was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public CustomObjectBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the CustomObject was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the CustomObject.

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

      public CustomObjectBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the CustomObject.

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

      public CustomObjectBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the CustomObject.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the CustomObject.

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

      public CustomObjectBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the CustomObject.

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

      public CustomObjectBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the CustomObject.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • container

      public CustomObjectBuilder container(String container)

      Namespace to group CustomObjects.

      Parameters:
      container - value to be set
      Returns:
      Builder
    • key

      public CustomObjectBuilder key(String key)

      User-defined unique identifier of the CustomObject within the defined container.

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

      public CustomObjectBuilder value(Object value)

      Can be any JSON standard type, such as number, string, boolean, array, object, or a common API data type.

      • For values of type Reference the integrity of the data is not guaranteed. If the referenced object is deleted, the API does not delete the corresponding reference to it and the value points to a non-existing object in such case.
      Parameters:
      value - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the CustomObject.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the CustomObject.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the CustomObject was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the CustomObject was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the CustomObject.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the CustomObject.

      Returns:
      createdBy
    • getContainer

      public String getContainer()

      Namespace to group CustomObjects.

      Returns:
      container
    • getKey

      public String getKey()

      User-defined unique identifier of the CustomObject within the defined container.

      Returns:
      key
    • getValue

      public Object getValue()

      Can be any JSON standard type, such as number, string, boolean, array, object, or a common API data type.

      • For values of type Reference the integrity of the data is not guaranteed. If the referenced object is deleted, the API does not delete the corresponding reference to it and the value points to a non-existing object in such case.
      Returns:
      value
    • build

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

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

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

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