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).voidsetDefaultMessage(String message) Sets the default message to use for validation failurevoidsetFieldName(String fieldName) Sets the field name to validate with this FieldValidatorvoidsetFieldValidator(FieldValidator fieldValidator) voidsetMessageKey(String key) Sets a resource bundle key to be used for lookup of validation failure messagevoidsetMessageParameters(String[] messageParameters) Sets the message parameters to be used when parsing i18n messagesvoidsetNamePrefix(String namePrefix) voidsetValidatorContext(ValidatorContext validatorContext) This method will be called before validate with a non-null ValidatorContext.voidsetValidatorType(String type) Sets the validator type to use (see class javadoc).voidsetValueStack(ValueStack stack) Sets the value stack to use to resolve values and parametersvoidThe 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:ValidatorGets the validator type used (see class javadoc).- Specified by:
getValidatorTypein interfaceValidator- Returns:
- the type used
-
getFieldName
Description copied from interface:FieldValidatorGets the field name to be validated- Specified by:
getFieldNamein interfaceFieldValidator- Returns:
- the field name
-
getFieldValidator
-
setFieldValidator
-
getDefaultMessage
Description copied from interface:ValidatorGets the default message used for validation failures- Specified by:
getDefaultMessagein interfaceValidator- Returns:
- the default message
-
getMessage
Description copied from interface:ValidatorGets the validation failure message for the given object- Specified by:
getMessagein interfaceValidator- Parameters:
object- object being validated (eg. a domain model object)- Returns:
- the validation failure message
-
getMessageKey
Description copied from interface:ValidatorGets the resource bundle key used for lookup of validation failure message- Specified by:
getMessageKeyin interfaceValidator- Returns:
- the resource bundle key
-
getMessageParameters
Description copied from interface:ValidatorGets the message parameters to be used when parsing i18n messages- Specified by:
getMessageParametersin interfaceValidator- Returns:
- the message parameters
-
getValidatorContext
Description copied from interface:ValidatorGets the validation context used- Specified by:
getValidatorContextin interfaceValidator- Returns:
- the validation context
-
setDefaultMessage
Description copied from interface:ValidatorSets the default message to use for validation failure- Specified by:
setDefaultMessagein interfaceValidator- Parameters:
message- the default message
-
setFieldName
Description copied from interface:FieldValidatorSets the field name to validate with this FieldValidator- Specified by:
setFieldNamein interfaceFieldValidator- Parameters:
fieldName- the field name
-
setMessageKey
Description copied from interface:ValidatorSets a resource bundle key to be used for lookup of validation failure message- Specified by:
setMessageKeyin interfaceValidator- Parameters:
key- the resource bundle key
-
setMessageParameters
Description copied from interface:ValidatorSets the message parameters to be used when parsing i18n messages- Specified by:
setMessageParametersin interfaceValidator- Parameters:
messageParameters- the message parameters
-
setValidatorContext
Description copied from interface:ValidatorThis method will be called before validate with a non-null ValidatorContext.- Specified by:
setValidatorContextin interfaceValidator- Parameters:
validatorContext- the validation context to use.
-
setValidatorType
Description copied from interface:ValidatorSets the validator type to use (see class javadoc).- Specified by:
setValidatorTypein interfaceValidator- Parameters:
type- the type to use.
-
setValueStack
Description copied from interface:ValidatorSets the value stack to use to resolve values and parameters- Specified by:
setValueStackin interfaceValidator- Parameters:
stack- The value stack for the request
-
validate
Description copied from interface:ValidatorThe validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.- Specified by:
validatein interfaceValidator- Parameters:
object- the object to be validated.- Throws:
ValidationException- is thrown if there is validation error(s).
-
getNamePrefix
-
setNamePrefix
-