@CompileStatic @Slf4j @ToString(includes: [owningClass, propertyType, propertyName, appliedConstraints]) class DefaultConstrainedProperty extends Object implements ConstrainedProperty
Default implementation of the ConstrainedProperty interface
| Modifiers | Name | Description |
|---|---|---|
protected Map<String, Constraint> |
appliedConstraints |
|
protected ConstraintRegistry |
constraintRegistry |
| Type | Name and description |
|---|---|
Map |
attributes |
Map |
attributes |
boolean |
blank |
boolean |
creditCard |
boolean |
displaywhether the property should be displayed |
boolean |
editablewhether the property is editable |
boolean |
email |
String |
formatthe format of the property (for example a date pattern) |
List |
inList |
String |
matches |
Comparable |
max |
Integer |
maxSize |
Comparable |
min |
Integer |
minSize |
Object |
notEqual |
boolean |
nullable |
int |
orderThe order of the property |
Class<?> |
owningClassThe owning class |
boolean |
passwordwhether the property is a password |
String |
propertyNamethe property name |
Class<?> |
propertyTypeThe property type |
Range |
range |
Range |
size |
boolean |
url |
String |
widgetThe widget to use to render the property |
| Constructor and description |
|---|
DefaultConstrainedProperty(Class<?> owningClass, String propertyName, Class<?> propertyType, ConstraintRegistry constraintRegistry)Constructs a new ConstrainedProperty for the given arguments. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
addMetaConstraint(String name, Object value)Adds a meta constraints which is a non-validating informational constraint. |
|
void |
applyConstraint(String constraintName, Object constrainingValue)Applies a constraint for the specified name and consraint value. |
|
protected void |
applyConstraintInternal(String constraintName, Object constrainingValue) |
|
Constraint |
getAppliedConstraint(String name)Obtains an applied constraint by name. |
|
Collection<Constraint> |
getAppliedConstraints()
|
|
Map |
getAttributes() |
|
List |
getInList()
|
|
String |
getMatches()
|
|
Comparable |
getMax()
|
|
Integer |
getMaxSize()
|
|
Object |
getMetaConstraintValue(String name)Obtains the value of the named meta constraint. |
|
Map<String, Object> |
getMetaConstraints()
|
|
Comparable |
getMin()
|
|
Integer |
getMinSize()
|
|
Object |
getNotEqual()
|
|
Class |
getOwner() |
|
Range |
getRange()
|
|
Integer |
getScale()
|
|
Range |
getSize()
|
|
boolean |
hasAppliedConstraint(String constraintName)
|
|
boolean |
isBlank()
|
|
boolean |
isCreditCard()
|
|
boolean |
isEmail()
|
|
boolean |
isNullable()
|
|
boolean |
isUrl()
|
|
void |
setAttributes(Map attributes) |
|
void |
setBlank(boolean blank)
|
|
void |
setCreditCard(boolean creditCard)
|
|
void |
setEmail(boolean email)
|
|
void |
setInList(List inList)
|
|
void |
setMatches(String regex)
|
|
void |
setMax(Comparable max)
|
|
void |
setMaxSize(Integer maxSize)
|
|
void |
setMin(Comparable min)
|
|
void |
setMinSize(Integer minSize)
|
|
void |
setNotEqual(Object notEqual)
|
|
void |
setNullable(boolean nullable)
|
|
void |
setRange(Range range)
|
|
void |
setSize(Range size)
|
|
void |
setUrl(boolean url)
|
|
boolean |
supportsContraint(String constraintName)Checks with this ConstraintedProperty instance supports applying the specified constraint. |
|
void |
validate(Object target, Object propertyValue, Errors errors)Validate this constrainted property against specified property value |
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 constraintGroovy Documentation