Package org.apache.tapestry5.services
Interface FieldValidatorSource
-
- All Known Implementing Classes:
FieldValidatorSourceImpl
@UsesMappedConfiguration(Validator.class) public interface FieldValidatorSource
Used to createFieldValidator
s for a particularField
component.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FieldValidator
createValidator(Field field, java.lang.String validatorType, java.lang.String constraintValue)
Creates the validator.FieldValidator
createValidator(Field field, java.lang.String validatorType, java.lang.String constraintValue, java.lang.String overrideId, Messages overrideMessages, java.util.Locale locale)
Full featured version ofcreateValidator(Field, String, String)
used in situations where the container of the field is not necessarily the place to look for override messages, and the id of the field is not the key to use when checking.FieldValidator
createValidators(Field field, java.lang.String specification)
Creates a set of validators.
-
-
-
Method Detail
-
createValidator
FieldValidator createValidator(Field field, java.lang.String validatorType, java.lang.String constraintValue)
Creates the validator. The error message associated with the field validator usually comes from the global message catalog (using the validator'smessage key
). However, if the container component of the field defines a message keyid-validator
(where id is the simple id of the field component, and validator is the validatorType), then that message is used instead. This allows you to override the message for a particular validation of a particular field.- Parameters:
field
- the field for which a validator is to be createdvalidatorType
- used to select theValidator
that forms the core of theFieldValidator
constraintValue
- a value used to configure the validator, or null if the validator is not configurarable- Returns:
- the field validator for the field
-
createValidator
FieldValidator createValidator(Field field, java.lang.String validatorType, java.lang.String constraintValue, java.lang.String overrideId, Messages overrideMessages, java.util.Locale locale)
Full featured version ofcreateValidator(Field, String, String)
used in situations where the container of the field is not necessarily the place to look for override messages, and the id of the field is not the key to use when checking. TheBeanEditForm
is an example of this.- Parameters:
field
- the field for which a validator is to be createdvalidatorType
- used to select theValidator
that forms the core of theFieldValidator
constraintValue
- a value used to configure the validator, or null if the validator is not configurableoverrideId
- the base id used when searching for validator message overrides (this would normally be the field component's simple id)overrideMessages
- the message catalog to search for override messages (this would normally be the catalog for the container of the field component)locale
- ignored, starting in 5.3 (it is allowed to pass null). Locale was needed in release 5.2 and earlier.- Returns:
- the field validator for the field
-
createValidators
FieldValidator createValidators(Field field, java.lang.String specification)
Creates a set of validators. The specification is a string used to identify and configure the individual validators. The specification is a comma-separated list of terms. Each term is a validator type name and an optional constraint value (separated by an equals sign).- Parameters:
field
-specification
-- Returns:
- a composite field validator
-
-