Interface FieldDefinition


public interface FieldDefinition

Defines a Custom Field and its meta-information. Maps to Type.FieldDefinition.


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 that you want to define. The name must be unique for a given ResourceTypeId. If a FieldDefinition with the same name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type. This value can't be changed after you import the 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. This value cannot be changed after the Type is imported.

      Returns:
      required
    • getInputHint

      TypeTextInputHint getInputHint()

      Provides a visual representation type for this field. It is only relevant for string-based field types 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 that you want to define. The name must be unique for a given ResourceTypeId. If a FieldDefinition with the same name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type. This value can't be changed after you import the 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. This value cannot be changed after the Type is imported.

      Parameters:
      required - value to be set
    • setInputHint

      void setInputHint(TypeTextInputHint inputHint)

      Provides a visual representation type for this field. It is only relevant for string-based field types 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
    • copyDeep

      FieldDefinition copyDeep()
    • 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