Class CustomObjectDraftBuilder

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

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

     CustomObjectDraft customObjectDraft = CustomObjectDraft.builder()
             .container("{container}")
             .key("{key}")
             .build()
 
  • Constructor Details

    • CustomObjectDraftBuilder

      public CustomObjectDraftBuilder()
  • Method Details

    • container

      public CustomObjectDraftBuilder container(String container)

      Namespace to group CustomObjects.

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

      public CustomObjectDraftBuilder key(String key)

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

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

      public CustomObjectDraftBuilder value(Object value)

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

      • Fields within value that have null values are not saved.
      • 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
    • version

      public CustomObjectDraftBuilder version(@Nullable Long version)

      Current version of the CustomObject.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • 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.

      • Fields within value that have null values are not saved.
      • 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
    • getVersion

      @Nullable public Long getVersion()

      Current version of the CustomObject.

      Returns:
      version
    • build

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

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

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

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