Interface FieldDefinition


public interface FieldDefinition

Defines a Custom Field and its meta-information. This FieldDefinition is similar to an AttributeDefinition of Product Types.


Example to create an instance using the builder pattern

     FieldDefinition fieldDefinition = FieldDefinition.builder()
             .type(typeBuilder -> typeBuilder)
             .name("{name}")
             .label(labelBuilder -> labelBuilder)
             .required(true)
             .build()
 
  • Method Details

    • getType

      @NotNull @Valid @NotNull @Valid FieldType getType()

      Data type of the Custom Field to define.

      Returns:
      type
    • getName

      @NotNull @NotNull String getName()

      Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.

      Returns:
      name
    • getLabel

      @NotNull @Valid @NotNull @Valid LocalizedString getLabel()

      A human-readable label for the field.

      Returns:
      label
    • getRequired

      @NotNull @NotNull Boolean getRequired()

      Defines whether the field is required to have a value.

      Returns:
      required
    • getInputHint

      TypeTextInputHint getInputHint()

      Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.

      Returns:
      inputHint
    • setType

      void setType(FieldType type)

      Data type of the Custom Field to define.

      Parameters:
      type - value to be set
    • setName

      void setName(String name)

      Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same name in another Type, both FieldDefinitions must have the same type.

      Parameters:
      name - value to be set
    • setLabel

      void setLabel(LocalizedString label)

      A human-readable label for the field.

      Parameters:
      label - value to be set
    • setRequired

      void setRequired(Boolean required)

      Defines whether the field is required to have a value.

      Parameters:
      required - value to be set
    • setInputHint

      void setInputHint(TypeTextInputHint inputHint)

      Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.

      Parameters:
      inputHint - value to be set
    • of

      static FieldDefinition of()
      factory method
      Returns:
      instance of FieldDefinition
    • of

      static FieldDefinition of(FieldDefinition template)
      factory method to create a shallow copy FieldDefinition
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static FieldDefinition deepCopy(@Nullable FieldDefinition template)
      factory method to create a deep copy of FieldDefinition
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static FieldDefinitionBuilder builder()
      builder factory method for FieldDefinition
      Returns:
      builder
    • builder

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

      default <T> T withFieldDefinition(Function<FieldDefinition,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<FieldDefinition> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference