Package com.day.cq.wcm.foundation.forms
Class FieldDescription
java.lang.Object
com.day.cq.wcm.foundation.forms.FieldDescription
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 Summary
ConstructorsConstructorDescriptionFieldDescription(Resource rsrc) Construct a new field description for a field resource.FieldDescription(Resource rsrc, String name) Construct a new field description for a field resource and set the name property. -
Method Summary
Modifier and TypeMethodDescriptionThe error message if the constraint is not met.Get the constraint type (might be null).Return the associated field resourcegetName()Return the name of the field.Return the error message for a required field.booleanIs this a multi value field?booleanIs this a private field?booleanIs this field readonly?booleanIs this field required?voidsetConstraintMessage(String constraintMsg) Set error message if the constraint is not met.voidsetConstraintType(String constraintType) Set the constraint type (might be null).voidsetMultiValue(boolean flag) Set if this is a private field.voidSet the name for the field.voidsetPrivateField(boolean flag) Set if this is a private field.voidsetReadOnly(boolean readOnly) Set if this field is readonly.voidsetRequired(boolean required) Set if this field is required.voidsetRequiredMessage(String requiredMsg) Set the error message for a required field.void
-
Constructor Details
-
FieldDescription
Construct a new field description for a field resource.- Parameters:
rsrc- field resource
-
FieldDescription
Construct a new field description for a field resource and set the name property.- Parameters:
rsrc- The resourcename- The field name.
-
-
Method Details
-
update
-
getFieldResource
Return the associated field resource- Returns:
- field resource
-
getName
Return the name of the field.- Returns:
- name of the field
-
setName
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
Return the error message for a required field.- Returns:
- error message for a required field
-
setRequiredMessage
Set the error message for a required field.- Parameters:
requiredMsg- error message for a required field
-
getConstraintType
Get the constraint type (might be null).- Returns:
- constraint type
-
setConstraintType
Set the constraint type (might be null).- Parameters:
constraintType- constraint type
-
getConstraintMessage
The error message if the constraint is not met.- Returns:
- error message if the constraint is not met
-
setConstraintMessage
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
-