Class FieldDefinitionBuilder

java.lang.Object
com.commercetools.history.models.common.FieldDefinitionBuilder
All Implemented Interfaces:
Builder<FieldDefinition>

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

     FieldDefinition fieldDefinition = FieldDefinition.builder()
             .type(typeBuilder -> typeBuilder)
             .name("{name}")
             .label(labelBuilder -> labelBuilder)
             .inputHint(TextInputHint.SINGLE_LINE)
             .build()
 
  • Constructor Details

    • FieldDefinitionBuilder

      public FieldDefinitionBuilder()
  • Method Details

    • type

      set the value to the type using the builder function
      Parameters:
      builder - function to build the type value
      Returns:
      Builder
    • withType

      set the value to the type using the builder function
      Parameters:
      builder - function to build the type value
      Returns:
      Builder
    • type

      public FieldDefinitionBuilder type(FieldType type)
      set the value to the type
      Parameters:
      type - value to be set
      Returns:
      Builder
    • name

      public FieldDefinitionBuilder name(String name)

      The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.

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

      set the value to the label using the builder function
      Parameters:
      builder - function to build the label value
      Returns:
      Builder
    • withLabel

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

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

      public FieldDefinitionBuilder inputHint(TextInputHint inputHint)
      set the value to the inputHint
      Parameters:
      inputHint - value to be set
      Returns:
      Builder
    • getType

      public FieldType getType()
      value of type}
      Returns:
      type
    • getName

      public String getName()

      The name of the field. The name must be between two and 36 characters long and can contain the ASCII letters A to Z in lowercase or uppercase, digits, underscores (_) and the hyphen-minus (-). The name must be unique for a given resource type ID. In case there is a field with the same name in another type it has to have the same FieldType also.

      Returns:
      name
    • getLabel

      public LocalizedString getLabel()
      value of label}
      Returns:
      label
    • getInputHint

      public TextInputHint getInputHint()
      value of inputHint}
      Returns:
      inputHint
    • build

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

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

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

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