| org.apache.tapestry.Validator
Validator | public interface Validator (Code) | | Used by a
Field to enforce a constraint related to a form submission.
Validators themselves are stateless singletons.
Validators are usually encapsulated inside a
FieldValidator .
|
Method Summary | |
Class<C> | getConstraintType() Returns the type of constraint value used with this validator. | String | getMessageKey() Returns the message key, within the validiation messages, normally used by this validator. | Class<T> | getValueType() Returns the value type associated with this validator. | boolean | invokeIfBlank() Returns true if the validator should be invoked for null or blank (empty string) values. | void | render(Field field, C constraintValue, MessageFormatter formatter, MarkupWriter writer, PageRenderSupport pageRenderSupport) Hook used by components to allow the validator to contribute additional attribute or (more
often) client-side JavaScript (via the
PageRenderSupport ). | void | validate(Field field, C constraintValue, MessageFormatter formatter, T value) Invoked after the client-submitted value has been
Translator translated to check that
the value conforms to expectations (often, in terms of minimum or maximum value). |
getConstraintType | Class<C> getConstraintType()(Code) | | Returns 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.
|
invokeIfBlank | boolean invokeIfBlank()(Code) | | Returns true if the validator should be invoked for null or blank (empty string) values. This
is generally false.
|
render | void render(Field field, C constraintValue, MessageFormatter formatter, MarkupWriter writer, PageRenderSupport pageRenderSupport)(Code) | | Hook used by components to allow the validator to contribute additional attribute or (more
often) client-side JavaScript (via the
PageRenderSupport ).
Parameters: field - the field which is currently being rendered Parameters: constraintValue - the value used to constrain input Parameters: formatter - validation message, in the appropriate locale Parameters: writer - markup writer, allowing additional attributes to be written into the activeelement Parameters: pageRenderSupport - used to generate client-side JavaScript to support validation |
validate | void validate(Field field, C constraintValue, MessageFormatter formatter, T value) throws ValidationException(Code) | | Invoked after the client-submitted value has been
Translator translated to check that
the value conforms to expectations (often, in terms of minimum or maximum value). If and only
if the value is approved by all Validators is the value applied by the field.
Parameters: field - the field for which a client submitted value is being validated Parameters: constraintValue - the value used to constrain Parameters: formatter - Validation messages, in the appropriate locale Parameters: value - the translated value supplied by the user throws: ValidationException - if the value violates the constraint |
|
|