Package org.apache.struts2.components
Class Form.FieldVisitorValidatorWrapper
java.lang.Object
org.apache.struts2.components.Form.FieldVisitorValidatorWrapper
- All Implemented Interfaces:
FieldValidator
,Validator
- Enclosing class:
- Form
Wrap field validator, add visitor's field prefix to the field name.
Javascript side is not aware of the visitor validators
and does not know how to prefix the fields.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the default message used for validation failuresGets the field name to be validatedgetMessage
(Object object) Gets the validation failure message for the given objectGets the resource bundle key used for lookup of validation failure messageString[]
Gets the message parameters to be used when parsing i18n messagesGets the validation context usedGets the validator type used (see class javadoc).void
setDefaultMessage
(String message) Sets the default message to use for validation failurevoid
setFieldName
(String fieldName) Sets the field name to validate with this FieldValidatorvoid
setFieldValidator
(FieldValidator fieldValidator) void
setMessageKey
(String key) Sets a resource bundle key to be used for lookup of validation failure messagevoid
setMessageParameters
(String[] messageParameters) Sets the message parameters to be used when parsing i18n messagesvoid
setNamePrefix
(String namePrefix) void
setValidatorContext
(ValidatorContext validatorContext) This method will be called before validate with a non-null ValidatorContext.void
setValidatorType
(String type) Sets the validator type to use (see class javadoc).void
setValueStack
(ValueStack stack) Sets the value stack to use to resolve values and parametersvoid
The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.
-
Constructor Details
-
FieldVisitorValidatorWrapper
-
-
Method Details
-
getValidatorType
Description copied from interface:Validator
Gets the validator type used (see class javadoc).- Specified by:
getValidatorType
in interfaceValidator
- Returns:
- the type used
-
getFieldName
Description copied from interface:FieldValidator
Gets the field name to be validated- Specified by:
getFieldName
in interfaceFieldValidator
- Returns:
- the field name
-
getFieldValidator
-
setFieldValidator
-
getDefaultMessage
Description copied from interface:Validator
Gets the default message used for validation failures- Specified by:
getDefaultMessage
in interfaceValidator
- Returns:
- the default message
-
getMessage
Description copied from interface:Validator
Gets the validation failure message for the given object- Specified by:
getMessage
in interfaceValidator
- Parameters:
object
- object being validated (eg. a domain model object)- Returns:
- the validation failure message
-
getMessageKey
Description copied from interface:Validator
Gets the resource bundle key used for lookup of validation failure message- Specified by:
getMessageKey
in interfaceValidator
- Returns:
- the resource bundle key
-
getMessageParameters
Description copied from interface:Validator
Gets the message parameters to be used when parsing i18n messages- Specified by:
getMessageParameters
in interfaceValidator
- Returns:
- the message parameters
-
getValidatorContext
Description copied from interface:Validator
Gets the validation context used- Specified by:
getValidatorContext
in interfaceValidator
- Returns:
- the validation context
-
setDefaultMessage
Description copied from interface:Validator
Sets the default message to use for validation failure- Specified by:
setDefaultMessage
in interfaceValidator
- Parameters:
message
- the default message
-
setFieldName
Description copied from interface:FieldValidator
Sets the field name to validate with this FieldValidator- Specified by:
setFieldName
in interfaceFieldValidator
- Parameters:
fieldName
- the field name
-
setMessageKey
Description copied from interface:Validator
Sets a resource bundle key to be used for lookup of validation failure message- Specified by:
setMessageKey
in interfaceValidator
- Parameters:
key
- the resource bundle key
-
setMessageParameters
Description copied from interface:Validator
Sets the message parameters to be used when parsing i18n messages- Specified by:
setMessageParameters
in interfaceValidator
- Parameters:
messageParameters
- the message parameters
-
setValidatorContext
Description copied from interface:Validator
This method will be called before validate with a non-null ValidatorContext.- Specified by:
setValidatorContext
in interfaceValidator
- Parameters:
validatorContext
- the validation context to use.
-
setValidatorType
Description copied from interface:Validator
Sets the validator type to use (see class javadoc).- Specified by:
setValidatorType
in interfaceValidator
- Parameters:
type
- the type to use.
-
setValueStack
Description copied from interface:Validator
Sets the value stack to use to resolve values and parameters- Specified by:
setValueStack
in interfaceValidator
- Parameters:
stack
- The value stack for the request
-
validate
Description copied from interface:Validator
The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.- Specified by:
validate
in interfaceValidator
- Parameters:
object
- the object to be validated.- Throws:
ValidationException
- is thrown if there is validation error(s).
-
getNamePrefix
-
setNamePrefix
-