|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springmodules.validation.bean.rule.AbstractValidationRule
public abstract class AbstractValidationRule
A super class for all specific validation rules.
| Constructor Summary | |
|---|---|
protected |
AbstractValidationRule(java.lang.String defaultErrorCode)
Constructs a new AbstractValidationRule with a default error code. |
protected |
AbstractValidationRule(java.lang.String defaultErrorCode,
ErrorArgumentsResolver defaultErrorArgumentsResolver)
Constructs a new AbstractValidationRule with a default error code and error argument resolver. |
| Method Summary | |
|---|---|
protected static ErrorArgumentsResolver |
createErrorArgumentsResolver(java.lang.Object arg)
A helper method for sub-classes helping with the creation of error argument resolvers. |
protected static ErrorArgumentsResolver |
createErrorArgumentsResolver(java.lang.Object[] arguments)
A helper method for sub-classes helping with the creation of error argument resolvers. |
protected static ErrorArgumentsResolver |
createErrorArgumentsResolver(java.lang.Object arg1,
java.lang.Object arg2)
A helper method for sub-classes helping with the creation of error argument resolvers. |
protected static ErrorArgumentsResolver |
createErrorArgumentsResolver(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
A helper method for sub-classes helping with the creation of error argument resolvers. |
java.lang.String |
getDefaultErrorMessage()
Returns the default error message that can be used in case no error message is bound to the error code of the rule. |
java.lang.Object[] |
getErrorArguments(java.lang.Object obj)
Returns the error arguments for this validation rule based on the given validated object. |
java.lang.String |
getErrorCode()
Return the error code of this validation rule. |
boolean |
isApplicable(java.lang.Object obj)
Checks if this validation rule is applicable on a given object by performing the following two steps: If the object is null and supportsNullValues() returns false
then returning false.
Returning whatever the applicablity condition check returns for the given object
(setApplicabilityCondition(org.springmodules.validation.util.condition.Condition)) |
void |
setApplicabilityCondition(Condition applicabilityCondition)
Sets the applicability condition that along with the supportsNullValues() method determines whether
this condition is applicable on a given object or not. |
void |
setDefaultErrorMessage(java.lang.String defaultErrorMessage)
Sets the default error message of this validation rule. |
void |
setErrorArgumentsResolver(ErrorArgumentsResolver errorArgumentsResolver)
Sets the ErrorArgumentsResolver that will be used by this validation to extract the error arguments
based on the validated object. |
void |
setErrorCode(java.lang.String errorCode)
Sets the error code of this validation rule. |
protected boolean |
supportsNullValues()
Determines whether this validation rule supports null values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.springmodules.validation.bean.rule.ValidationRule |
|---|
getCondition |
| Constructor Detail |
|---|
protected AbstractValidationRule(java.lang.String defaultErrorCode)
defaultErrorCode -
protected AbstractValidationRule(java.lang.String defaultErrorCode,
ErrorArgumentsResolver defaultErrorArgumentsResolver)
defaultErrorCode - The default error code for this validation rule.defaultErrorArgumentsResolver - The argument resolver for this validation rule.| Method Detail |
|---|
public boolean isApplicable(java.lang.Object obj)
null and supportsNullValues() returns false
then returning false.setApplicabilityCondition(org.springmodules.validation.util.condition.Condition))
isApplicable in interface ValidationRuleobj - The object to be validated
ValidationRule.isApplicable(Object)public java.lang.String getErrorCode()
ValidationRulenull.
getErrorCode in interface ValidationRuleValidationRule.getErrorCode()public java.lang.Object[] getErrorArguments(java.lang.Object obj)
ErrorArgumentsResolver.
getErrorArguments in interface ValidationRuleobj - The validated object.
setErrorArgumentsResolver(org.springmodules.validation.bean.rule.resolver.ErrorArgumentsResolver),
ValidationRule.getErrorArguments(Object)public java.lang.String getDefaultErrorMessage()
ValidationRulenull to indicate that
no default message exists.
getDefaultErrorMessage in interface ValidationRuleValidationRule.getDefaultErrorMessage()protected boolean supportsNullValues()
null values. This method by default returns false,
any sub-class that supports null values should override this method and return true.
null values.public void setErrorCode(java.lang.String errorCode)
errorCode - The error code of this validation rule.public void setDefaultErrorMessage(java.lang.String defaultErrorMessage)
defaultErrorMessage - The default error message of this validation rule.public void setErrorArgumentsResolver(ErrorArgumentsResolver errorArgumentsResolver)
ErrorArgumentsResolver that will be used by this validation to extract the error arguments
based on the validated object.
errorArgumentsResolver - The error argument resolver that will be used by this validator.public void setApplicabilityCondition(Condition applicabilityCondition)
supportsNullValues() method determines whether
this condition is applicable on a given object or not.
applicabilityCondition - The applicability condition that will be used by this validation rule when deciding
whether it is applicable on a given object.protected static ErrorArgumentsResolver createErrorArgumentsResolver(java.lang.Object arg)
arg as the error
arguments.
arg - The error argument to be returned along with the validated object.
protected static ErrorArgumentsResolver createErrorArgumentsResolver(java.lang.Object arg1,
java.lang.Object arg2)
arg1 - The error argument to be returned in position {1}arg2 - The error argument to be returned in position {2}
protected static ErrorArgumentsResolver createErrorArgumentsResolver(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
arg1 - The error argument to be returned in position {1}arg2 - The error argument to be returned in position {2}arg3 - The error argument to be returned in position {3}
protected static ErrorArgumentsResolver createErrorArgumentsResolver(java.lang.Object[] arguments)
arguments - The error arguments that will be return along with the validated object, starting in position {1}.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||