org.springmodules.validation.bean.rule
Interface ValidationRule
- All Known Implementing Classes:
- AbstractValidationRule, DateInTheFutureValidationRule, DateInThePastValidationRule, DefaultValidationRule, EmailValidationRule, ExpressionValidationRule, InstantInTheFutureValidationRule, InstantInThePastValidationRule, LengthValidationRule, MaxLengthValidationRule, MaxSizeValidationRule, MaxValidationRule, MinLengthValidationRule, MinSizeValidationRule, MinValidationRule, NotBlankValidationRule, NotEmptyValidationRule, NotNullValidationRule, PropertyValidationRule, RangeValidationRule, RegExpValidationRule, SizeValidationRule
public interface ValidationRule
Represents a validation rule. A validation rule binds an error to a condition.
- Author:
- Uri Boness
|
Method Summary |
Condition |
getCondition()
Returns the condition of this validation rule. |
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 arguments that apply to the error code of this validation rule. |
java.lang.String |
getErrorCode()
Return the error code of this validation rule. |
boolean |
isApplicable(java.lang.Object obj)
Checks whether this validation is applicable on the given object. |
isApplicable
boolean isApplicable(java.lang.Object obj)
- Checks whether this validation is applicable on the given object. This can be used
to define applicability rules base on runtime factors.
- Parameters:
obj - The object to be validated
- Returns:
- True if this validation rule is applicable on the given obj, false otherwise.
getCondition
Condition getCondition()
- Returns the condition of this validation rule.
- Returns:
- The condition of this validation rule.
getErrorCode
java.lang.String getErrorCode()
- Return the error code of this validation rule. This method cannot return
null.
- Returns:
- The error code of this validation rule.
getErrorArguments
java.lang.Object[] getErrorArguments(java.lang.Object obj)
- Returns the arguments that apply to the error code of this validation rule. This
method should never return null. If there are no arguments, this method must return
an empty array. This method accepts the validated object, this enables runtime generation
of arguments based on that object.
- Parameters:
obj - The validated object.
- Returns:
- The arguments that apply to the error code of this validation rule.
getDefaultErrorMessage
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. This method can return
null to indicate that
no default message exists.
- Returns:
- The default error message of this validation rule.
Copyright © 2005. All Rights Reserved.