@groovy.transform.CompileStatic @groovy.util.logging.Slf4j @groovy.transform.ToString(includes: [owningClass, propertyType, propertyName, appliedConstraints]) class DefaultConstrainedProperty extends java.lang.Object implements ConstrainedProperty
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 |
java.util.Map |
attributes |
boolean |
blank |
boolean |
creditCard |
java.lang.Object |
display |
DisplayType |
displayTypethe display type controlling where the property is shown in scaffolded views |
boolean |
editablewhether the property is editable |
boolean |
email |
java.lang.String |
formatthe format of the property (for example a date pattern) |
java.util.List |
inList |
java.lang.String |
matches |
java.lang.Comparable |
max |
java.lang.Integer |
maxSize |
java.lang.Comparable |
min |
java.lang.Integer |
minSize |
java.lang.Object |
notEqual |
boolean |
nullable |
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 |
groovy.lang.Range |
range |
groovy.lang.Range |
size |
boolean |
url |
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()
|
|
java.util.Map |
getAttributes() |
|
java.lang.Object |
getDisplay()Returns the display value for property access compatibility with ClassPropertyFetcher. |
|
DisplayType |
getDisplayType()
|
|
java.util.List |
getInList()
|
|
java.lang.String |
getMatches()
|
|
java.lang.Comparable |
getMax()
|
|
java.lang.Integer |
getMaxSize()
|
|
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()
|
|
java.lang.Comparable |
getMin()
|
|
java.lang.Integer |
getMinSize()
|
|
java.lang.Object |
getNotEqual()
|
|
java.lang.Class |
getOwner() |
|
groovy.lang.Range |
getRange()
|
|
java.lang.Integer |
getScale()
|
|
groovy.lang.Range |
getSize()
|
|
boolean |
hasAppliedConstraint(java.lang.String constraintName)
|
|
boolean |
isBlank()
|
|
boolean |
isCreditCard()
|
|
boolean |
isDisplay()
|
|
boolean |
isEmail()
|
|
boolean |
isNullable()
|
|
boolean |
isUrl()
|
|
void |
setAttributes(java.util.Map attributes) |
|
void |
setBlank(boolean blank)
|
|
void |
setCreditCard(boolean creditCard)
|
|
void |
setDisplay(java.lang.Object value)Sets the display constraint with backwards compatibility for boolean values. |
|
void |
setEmail(boolean email)
|
|
void |
setInList(java.util.List inList)
|
|
void |
setMatches(java.lang.String regex)
|
|
void |
setMax(java.lang.Comparable max)
|
|
void |
setMaxSize(java.lang.Integer maxSize)
|
|
void |
setMin(java.lang.Comparable min)
|
|
void |
setMinSize(java.lang.Integer minSize)
|
|
void |
setNotEqual(java.lang.Object notEqual)
|
|
void |
setNullable(boolean nullable)
|
|
void |
setRange(groovy.lang.Range range)
|
|
void |
setSize(groovy.lang.Range size)
|
|
void |
setUrl(boolean url)
|
|
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, Errors errors)Validate this constrainted property against specified property value |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
the display type controlling where the property is shown in scaffolded views
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
Returns the display value for property access compatibility with ClassPropertyFetcher. Returns the displayType if set, otherwise returns the boolean display value. This method exists to ensure ClassPropertyFetcher.getPropertyDescriptor("display") works.
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.Sets the display constraint with backwards compatibility for boolean values.
value - Can be a Boolean (true/false) or a DisplayType enum value
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