public abstract class AbstractConstraint extends java.lang.Object implements Constraint
Abstract class for constraints to extend.
Modifiers | Name | Description |
---|---|---|
protected java.lang.String |
classShortName |
|
protected java.lang.Class<?> |
constraintOwningClass |
|
protected java.lang.Object |
constraintParameter |
|
protected java.lang.String |
constraintPropertyName |
|
private java.lang.String |
fullQualifiedConstraintErrorCode |
|
private java.lang.String |
fullQualifiedPrefix |
|
protected org.springframework.context.MessageSource |
messageSource |
|
private java.lang.String |
shortNameConstraintErrorCode |
|
private java.lang.String |
shortNamePrefix |
Constructor and description |
---|
AbstractConstraint
(java.lang.Class<?> constraintOwningClass, java.lang.String constraintPropertyName, java.lang.Object constraintParameter, org.springframework.context.MessageSource messageSource) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected void |
checkState() |
|
protected java.lang.String |
getDefaultMessage(java.lang.String code) Returns the default message for the given message code in the current locale. |
|
public java.lang.Object |
getParameter() |
|
public java.lang.String |
getPropertyName() |
|
private java.lang.Object |
getPropertyValue(org.springframework.validation.Errors errors, java.lang.Object target) |
|
public boolean |
isValid() Return whether the constraint is valid for the owning class |
|
protected abstract void |
processValidate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors) |
|
public void |
rejectValue(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String defaultMessageCode, java.lang.Object[] args) |
|
public void |
rejectValue(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String defaultMessageCode, java.lang.String code, java.lang.Object[] args) |
|
public void |
rejectValue(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String defaultMessageCode, java.lang.String[] codes, java.lang.Object[] args) |
|
public void |
rejectValue(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String code, java.lang.String defaultMessage) |
|
public void |
rejectValue(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage) |
|
public void |
rejectValueWithDefaultMessage(java.lang.Object target, org.springframework.validation.Errors errors, java.lang.String defaultMessage, java.lang.String[] codes, java.lang.Object[] args) |
|
protected boolean |
skipBlankValues() |
|
protected boolean |
skipNullValues() |
|
public java.lang.String |
toString() |
|
public void |
validate(java.lang.Object target, java.lang.Object propertyValue, org.springframework.validation.Errors errors) |
|
protected abstract java.lang.Object |
validateParameter(java.lang.Object constraintParameter) Validate the parameter passed |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |
Returns the default message for the given message code in the current locale. Note that the string returned includes any placeholders that the required message has - these must be expanded by the caller if required.
code
- The i18n message code to look up.Return whether the constraint is valid for the owning class
Validate the parameter passed
constraintParameter
- The parameter to validate