Package org.apache.tapestry5.validator
Class AbstractValidator<C,T>
java.lang.Object
org.apache.tapestry5.validator.AbstractValidator<C,T>
- All Implemented Interfaces:
Validator<C,T>
- Direct Known Subclasses:
Checked,Email,Max,MaxLength,Min,MinLength,None,Regexp,Required,Unchecked
Base class for constructing a
Validator.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractValidator(Class<C> constraintType, Class<T> valueType, String messageKey, JavaScriptSupport javaScriptSupport) -
Method Summary
Modifier and TypeMethodDescriptionReturns the type of constraint value used with this validator.final StringReturns the message key, within the validation messages, normally used by this validator.Returns the value type associated with this validator.booleanReturn false, which is correct for the vast majority of validators.
-
Field Details
-
javaScriptSupport
-
-
Constructor Details
-
AbstractValidator
protected AbstractValidator(Class<C> constraintType, Class<T> valueType, String messageKey, JavaScriptSupport javaScriptSupport)
-
-
Method Details
-
getConstraintType
Description copied from interface:ValidatorReturns the type of constraint value used with this validator. Constraint values are used to parameterize a validator, for example a "maxLength" validator will have a constraint value of type int (the maximum length allowed). For constraints that do not have a constraint value, this method returns null.- Specified by:
getConstraintTypein interfaceValidator<C,T>
-
getValueType
Description copied from interface:ValidatorReturns the value type associated with this validator.Validator.validate(Field, Object, MessageFormatter, Object)will only be invoked when the value is assignable to the validator's value type.- Specified by:
getValueTypein interfaceValidator<C,T>
-
getMessageKey
Description copied from interface:ValidatorReturns the message key, within the validation messages, normally used by this validator. This is used to provide theMessageFormatterpassed toValidator.validate(Field, Object, MessageFormatter, Object)(unless overridden).- Specified by:
getMessageKeyin interfaceValidator<C,T> - Returns:
- a message key
-
isRequired
Return false, which is correct for the vast majority of validators.Requiredoverrides this to true.F- Specified by:
isRequiredin interfaceValidator<C,T>
-