@groovy.transform.CompileStatic @groovy.util.logging.Slf4j @groovy.transform.ToString(includes = ['owningClass', 'propertyType', 'propertyName', 'appliedConstraints']) class DefaultConstrainedProperty extends java.lang.Object
Default implementation of the ConstrainedProperty interface
| Modifiers | Name | Description |
|---|---|---|
protected java.util.Map<java.lang.String, Constraint> |
appliedConstraints |
|
protected ConstraintRegistry |
constraintRegistry |
| Type | Name and description |
|---|---|
java.util.Map |
attributes |
boolean |
displaywhether the property should be displayed |
boolean |
editablewhether the property is editable |
java.lang.String |
formatthe format of the property (for example a date pattern) |
int |
orderThe order of the property |
java.lang.Class<?> |
owningClassThe owning class |
boolean |
passwordwhether the property is a password |
java.lang.String |
propertyNamethe property name |
java.lang.Class<?> |
propertyTypeThe property type |
java.lang.String |
widgetThe widget to use to render the property |
| Constructor and description |
|---|
DefaultConstrainedProperty
(java.lang.Class<?> owningClass, java.lang.String propertyName, java.lang.Class<?> propertyType, ConstraintRegistry constraintRegistry)Constructs a new ConstrainedProperty for the given arguments. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
addMetaConstraint(java.lang.String name, java.lang.Object value)Adds a meta constraints which is a non-validating informational constraint. |
|
void |
applyConstraint(java.lang.String constraintName, java.lang.Object constrainingValue)Applies a constraint for the specified name and consraint value. |
|
protected void |
applyConstraintInternal(java.lang.String constraintName, java.lang.Object constrainingValue) |
|
Constraint |
getAppliedConstraint(java.lang.String name)Obtains an applied constraint by name. |
|
java.util.Collection<Constraint> |
getAppliedConstraints()@return Returns the appliedConstraints. |
|
java.util.Map |
getAttributes() |
|
java.util.List |
getInList()@return Returns the inList. |
|
java.lang.String |
getMatches()@return Returns the matches. |
|
java.lang.Comparable |
getMax()@return Returns the max. |
|
java.lang.Integer |
getMaxSize()@return Returns the maxSize. |
|
java.lang.Object |
getMetaConstraintValue(java.lang.String name)Obtains the value of the named meta constraint. |
|
java.util.Map<java.lang.String, java.lang.Object> |
getMetaConstraints()@return Returns the metaConstraints. |
|
java.lang.Comparable |
getMin()@return Returns the min. |
|
java.lang.Integer |
getMinSize()@return Returns the minSize. |
|
java.lang.Object |
getNotEqual()@return Returns the notEqual. |
|
java.lang.Class |
getOwner() |
|
groovy.lang.Range |
getRange()@return Returns the range. |
|
java.lang.Integer |
getScale()@return The scale, if defined for this property; null, otherwise |
|
groovy.lang.Range |
getSize()@return Returns the size. |
|
boolean |
hasAppliedConstraint(java.lang.String constraintName)@param constraintName The name of the constraint to check |
|
boolean |
isBlank()@return the blank. |
|
boolean |
isCreditCard()@return Returns the creditCard. |
|
boolean |
isEmail()@return Returns the email. |
|
boolean |
isNullable()@return Returns the nullable. |
|
boolean |
isUrl()@return Returns the url. |
|
void |
setAttributes(java.util.Map attributes) |
|
void |
setBlank(boolean blank)@param blank The blank to set. |
|
void |
setCreditCard(boolean creditCard)@param creditCard The creditCard to set. |
|
void |
setEmail(boolean email)@param email The email to set. |
|
void |
setInList(java.util.List inList)@param inList The inList to set. |
|
void |
setMatches(java.lang.String regex)@param regex The matches to set. |
|
void |
setMax(java.lang.Comparable max)@param max The max to set. |
|
void |
setMaxSize(java.lang.Integer maxSize)@param maxSize The maxSize to set. |
|
void |
setMin(java.lang.Comparable min)@param min The min to set. |
|
void |
setMinSize(java.lang.Integer minSize)@param minSize The minLength to set. |
|
void |
setNotEqual(java.lang.Object notEqual)@param notEqual The notEqual to set. |
|
void |
setNullable(boolean nullable)@param nullable The nullable to set. |
|
void |
setRange(groovy.lang.Range range)@param range The range to set. |
|
void |
setSize(groovy.lang.Range size)@param size The size to set. |
|
void |
setUrl(boolean url)@param url The url to set. |
|
boolean |
supportsContraint(java.lang.String constraintName)Checks with this ConstraintedProperty instance supports applying the specified constraint. |
|
void |
validate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors)Validate this constrainted property against specified property value |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
whether the property should be displayed
whether the property is editable
the format of the property (for example a date pattern)
The order of the property
The owning class
whether the property is a password
the property name
The property type
The widget to use to render the property
Constructs a new ConstrainedProperty for the given arguments.
owningClass - The owning classpropertyName - The name of the propertypropertyType - The property typeAdds a meta constraints which is a non-validating informational constraint.
name - The name of the constraintvalue - The valueApplies a constraint for the specified name and consraint value.
supportsContraint(String constraintName) to check before callingconstraintName - The name of the constraintconstrainingValue - The constraining valueObtains an applied constraint by name.
name - The name of the constraint
Obtains the value of the named meta constraint.
name - The name of the constraint
constraintName - The name of the constraint to check
blank - The blank to set.
creditCard - The creditCard to set.
email - The email to set.
inList - The inList to set.
regex - The matches to set.
max - The max to set.
maxSize - The maxSize to set.
min - The min to set.
minSize - The minLength to set.
notEqual - The notEqual to set.
nullable - The nullable to set.
range - The range to set.
size - The size to set.
url - The url to set.Checks with this ConstraintedProperty instance supports applying the specified constraint.
constraintName - The name of the constraintValidate this constrainted property against specified property value
target - The target object to validatepropertyValue - The value of the property to validateerrors - The Errors instances to report errors to