Class FieldDescription

java.lang.Object
com.day.cq.wcm.foundation.forms.FieldDescription

public class FieldDescription extends Object
A description of a form field as it is later used in the html form. A field component usually maps to a single field description, however compound fields like an address field map to several field descriptions. The field description is used mostly during validation as it contains all necessary information. Field descriptions can be maintained from the FieldHelper.
Since:
5.3
  • Constructor Details

    • FieldDescription

      public FieldDescription(Resource rsrc)
      Construct a new field description for a field resource.
      Parameters:
      rsrc - field resource
    • FieldDescription

      public FieldDescription(Resource rsrc, String name)
      Construct a new field description for a field resource and set the name property.
      Parameters:
      rsrc - The resource
      name - The field name.
  • Method Details

    • update

      public void update(Resource rsrc)
    • getFieldResource

      public Resource getFieldResource()
      Return the associated field resource
      Returns:
      field resource
    • getName

      public String getName()
      Return the name of the field.
      Returns:
      name of the field
    • setName

      public void setName(String name)
      Set the name for the field.
      Parameters:
      name - field name
    • isRequired

      public boolean isRequired()
      Is this field required?
      Returns:
      true if field is required
    • setRequired

      public void setRequired(boolean required)
      Set if this field is required.
      Parameters:
      required - indicates whether field is required
    • getRequiredMessage

      public String getRequiredMessage()
      Return the error message for a required field.
      Returns:
      error message for a required field
    • setRequiredMessage

      public void setRequiredMessage(String requiredMsg)
      Set the error message for a required field.
      Parameters:
      requiredMsg - error message for a required field
    • getConstraintType

      public String getConstraintType()
      Get the constraint type (might be null).
      Returns:
      constraint type
    • setConstraintType

      public void setConstraintType(String constraintType)
      Set the constraint type (might be null).
      Parameters:
      constraintType - constraint type
    • getConstraintMessage

      public String getConstraintMessage()
      The error message if the constraint is not met.
      Returns:
      error message if the constraint is not met
    • setConstraintMessage

      public void setConstraintMessage(String constraintMsg)
      Set error message if the constraint is not met.
      Parameters:
      constraintMsg - error message if the constraint is not met
    • isReadOnly

      public boolean isReadOnly()
      Is this field readonly?
      Returns:
      true if field is read only
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Set if this field is readonly.
      Parameters:
      readOnly - indicates whether field is read only
    • isPrivate

      public boolean isPrivate()
      Is this a private field?
      Returns:
      true if field is private
    • setPrivateField

      public void setPrivateField(boolean flag)
      Set if this is a private field.
      Parameters:
      flag - indicates whether field is private
    • isMultiValue

      public boolean isMultiValue()
      Is this a multi value field?
      Returns:
      true if field is multi value
    • setMultiValue

      public void setMultiValue(boolean flag)
      Set if this is a private field.
      Parameters:
      flag - indicates whether field is multi value