Package com.day.cq.wcm.foundation.forms
Class FieldDescription
- java.lang.Object
-
- com.day.cq.wcm.foundation.forms.FieldDescription
-
public class FieldDescription extends java.lang.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 theFieldHelper
.- Since:
- 5.3
-
-
Constructor Summary
Constructors Constructor Description FieldDescription(Resource rsrc)
Construct a new field description for a field resource.FieldDescription(Resource rsrc, java.lang.String name)
Construct a new field description for a field resource and set the name property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getConstraintMessage()
The error message if the constraint is not met.java.lang.String
getConstraintType()
Get the constraint type (might be null).Resource
getFieldResource()
Return the associated field resourcejava.lang.String
getName()
Return the name of the field.java.lang.String
getRequiredMessage()
Return the error message for a required field.boolean
isMultiValue()
Is this a multi value field?boolean
isPrivate()
Is this a private field?boolean
isReadOnly()
Is this field readonly?boolean
isRequired()
Is this field required?void
setConstraintMessage(java.lang.String constraintMsg)
Set error message if the constraint is not met.void
setConstraintType(java.lang.String constraintType)
Set the constraint type (might be null).void
setMultiValue(boolean flag)
Set if this is a private field.void
setName(java.lang.String name)
Set the name for the field.void
setPrivateField(boolean flag)
Set if this is a private field.void
setReadOnly(boolean readOnly)
Set if this field is readonly.void
setRequired(boolean required)
Set if this field is required.void
setRequiredMessage(java.lang.String requiredMsg)
Set the error message for a required field.void
update(Resource rsrc)
-
-
-
Constructor Detail
-
FieldDescription
public FieldDescription(Resource rsrc)
Construct a new field description for a field resource.- Parameters:
rsrc
- field resource
-
FieldDescription
public FieldDescription(Resource rsrc, java.lang.String name)
Construct a new field description for a field resource and set the name property.- Parameters:
rsrc
- The resourcename
- The field name.
-
-
Method Detail
-
update
public void update(Resource rsrc)
-
getFieldResource
public Resource getFieldResource()
Return the associated field resource- Returns:
- field resource
-
getName
public java.lang.String getName()
Return the name of the field.- Returns:
- name of the field
-
setName
public void setName(java.lang.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 java.lang.String getRequiredMessage()
Return the error message for a required field.- Returns:
- error message for a required field
-
setRequiredMessage
public void setRequiredMessage(java.lang.String requiredMsg)
Set the error message for a required field.- Parameters:
requiredMsg
- error message for a required field
-
getConstraintType
public java.lang.String getConstraintType()
Get the constraint type (might be null).- Returns:
- constraint type
-
setConstraintType
public void setConstraintType(java.lang.String constraintType)
Set the constraint type (might be null).- Parameters:
constraintType
- constraint type
-
getConstraintMessage
public java.lang.String getConstraintMessage()
The error message if the constraint is not met.- Returns:
- error message if the constraint is not met
-
setConstraintMessage
public void setConstraintMessage(java.lang.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
-
-