Class TypeBuilder

java.lang.Object
com.commercetools.api.models.type.TypeBuilder
All Implemented Interfaces:
Builder<Type>

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

     Type type = Type.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .key("{key}")
             .name(nameBuilder -> nameBuilder)
             .plusResourceTypeIds(resourceTypeIdsBuilder -> resourceTypeIdsBuilder)
             .plusFieldDefinitions(fieldDefinitionsBuilder -> fieldDefinitionsBuilder)
             .build()
 
  • Constructor Details

    • TypeBuilder

      public TypeBuilder()
  • Method Details

    • id

      public TypeBuilder id(String id)

      Unique identifier of the Type.

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

      public TypeBuilder version(Long version)

      Current version of the Type.

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

      public TypeBuilder createdAt(ZonedDateTime createdAt)

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

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

      public TypeBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      IDs and references that last modified the Type.

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

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

      IDs and references that last modified the Type.

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

      public TypeBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Type.

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

      IDs and references that created the Type.

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

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

      IDs and references that created the Type.

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

      public TypeBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Type.

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

      public TypeBuilder key(String key)

      User-defined unique identifier of the Type.

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

      Name of the Type.

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

      Name of the Type.

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

      public TypeBuilder name(LocalizedString name)

      Name of the Type.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • description

      Description of the Type.

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

      public TypeBuilder withDescription(Function<LocalizedStringBuilder,LocalizedString> builder)

      Description of the Type.

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

      public TypeBuilder description(@Nullable LocalizedString description)

      Description of the Type.

      Parameters:
      description - value to be set
      Returns:
      Builder
    • resourceTypeIds

      public TypeBuilder resourceTypeIds(ResourceTypeId... resourceTypeIds)

      Resources and/or data types for which the Type is defined.

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

      public TypeBuilder resourceTypeIds(List<ResourceTypeId> resourceTypeIds)

      Resources and/or data types for which the Type is defined.

      Parameters:
      resourceTypeIds - value to be set
      Returns:
      Builder
    • plusResourceTypeIds

      public TypeBuilder plusResourceTypeIds(ResourceTypeId... resourceTypeIds)

      Resources and/or data types for which the Type is defined.

      Parameters:
      resourceTypeIds - value to be set
      Returns:
      Builder
    • fieldDefinitions

      public TypeBuilder fieldDefinitions(FieldDefinition... fieldDefinitions)

      Defines Custom Fields.

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

      public TypeBuilder fieldDefinitions(List<FieldDefinition> fieldDefinitions)

      Defines Custom Fields.

      Parameters:
      fieldDefinitions - value to be set
      Returns:
      Builder
    • plusFieldDefinitions

      public TypeBuilder plusFieldDefinitions(FieldDefinition... fieldDefinitions)

      Defines Custom Fields.

      Parameters:
      fieldDefinitions - value to be set
      Returns:
      Builder
    • plusFieldDefinitions

      public TypeBuilder plusFieldDefinitions(Function<FieldDefinitionBuilder,FieldDefinitionBuilder> builder)

      Defines Custom Fields.

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

      public TypeBuilder withFieldDefinitions(Function<FieldDefinitionBuilder,FieldDefinitionBuilder> builder)

      Defines Custom Fields.

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

      public TypeBuilder addFieldDefinitions(Function<FieldDefinitionBuilder,FieldDefinition> builder)

      Defines Custom Fields.

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

      public TypeBuilder setFieldDefinitions(Function<FieldDefinitionBuilder,FieldDefinition> builder)

      Defines Custom Fields.

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

      public String getId()

      Unique identifier of the Type.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Type.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Type.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Type.

      Returns:
      createdBy
    • getKey

      public String getKey()

      User-defined unique identifier of the Type.

      Returns:
      key
    • getName

      public LocalizedString getName()

      Name of the Type.

      Returns:
      name
    • getDescription

      @Nullable public LocalizedString getDescription()

      Description of the Type.

      Returns:
      description
    • getResourceTypeIds

      public List<ResourceTypeId> getResourceTypeIds()

      Resources and/or data types for which the Type is defined.

      Returns:
      resourceTypeIds
    • getFieldDefinitions

      public List<FieldDefinition> getFieldDefinitions()

      Defines Custom Fields.

      Returns:
      fieldDefinitions
    • build

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

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

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

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