public interface ValidatorFactory
Validator
instances from a specification. A
specification is a comma-seperated list of entries. Each entry is in one of the following forms:
Most validator classes are configurable: they have a property that matches their
name. For example, MinDate
(which is named "minDate"
has a minDate
property. A few validators are not configurable ("required" =>
Required
, for example).
Validators are expected to have a public no-args constructor. They are also expected to have a
message
property which is set from the value in brackets.
The message is either a literal string, or may be prefixed with a '%' character, to indicate
a localized key, resolved using the component's message catalog.
When the name is prefixed with a dollary sign, it indicates a reference to a bean with the given name.
A full validator specification might be:
required,email[%email-format],minLength=20[Email addresses must be at least 20 characters long.]
Modifier and Type | Method and Description |
---|---|
java.util.List |
constructValidatorList(IComponent component,
java.lang.String specification)
Constructs a new (immutable) List of
Validator , or returns a previously constructed
List. |
java.util.List constructValidatorList(IComponent component, java.lang.String specification)
Validator
, or returns a previously constructed
List.component
- the component for which the list is being createdspecification
- a string identifying which validators and their configurationValidator
(possibly empty)