public abstract class AbstractConstraint extends Object implements Constraint
Abstract class for constraints to extend.
| Modifiers | Name | Description |
|---|---|---|
protected String |
classShortName |
|
protected Class<?> |
constraintOwningClass |
|
protected Object |
constraintParameter |
|
protected String |
constraintPropertyName |
|
protected MessageSource |
messageSource |
| Constructor and description |
|---|
AbstractConstraint(Class<?> constraintOwningClass, String constraintPropertyName, Object constraintParameter, MessageSource messageSource) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
checkState() |
|
protected String |
getDefaultMessage(String code)Returns the default message for the given message code in the current locale. |
|
public Object |
getParameter() |
|
public String |
getPropertyName() |
|
public boolean |
isValid()Return whether the constraint is valid for the owning class |
|
protected abstract void |
processValidate(Object target, Object propertyValue, Errors errors) |
|
public void |
rejectValue(Object target, Errors errors, String defaultMessageCode, Object[] args) |
|
public void |
rejectValue(Object target, Errors errors, String defaultMessageCode, String code, Object[] args) |
|
public void |
rejectValue(Object target, Errors errors, String defaultMessageCode, String[] codes, Object[] args) |
|
public void |
rejectValue(Object target, Errors errors, String code, String defaultMessage) |
|
public void |
rejectValue(Object target, Errors errors, String code, Object[] args, String defaultMessage) |
|
public void |
rejectValueWithDefaultMessage(Object target, Errors errors, String defaultMessage, String[] codes, Object[] args) |
|
protected boolean |
skipBlankValues() |
|
protected boolean |
skipNullValues() |
|
public String |
toString() |
|
public void |
validate(Object target, Object propertyValue, Errors errors) |
|
protected abstract Object |
validateParameter(Object constraintParameter)Validate the parameter passed |
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