public abstract class ValidatorSupport extends Object implements Validator, ShortCircuitableValidator
| Modifier and Type | Field and Description | 
|---|---|
| protected String | defaultMessage | 
| static String | EMPTY_STRING | 
| protected String | messageKey | 
| protected ValueStack | stack | 
| protected TextProviderFactory | textProviderFactory | 
| Constructor and Description | 
|---|
| ValidatorSupport() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | addActionError(Object object) | 
| protected void | addFieldError(String propertyName,
             Object object) | 
| String | getDefaultMessage()Gets the default message used for validation failures | 
| protected Object | getFieldValue(String name,
             Object object)Return the field value named  namefromobject,objectshould have the appropriate getter/setter. | 
| String | getMessage(Object object)Gets the validation failure message for the given object | 
| String | getMessageKey()Gets the resource bundle key used for lookup of validation failure message | 
| String[] | getMessageParameters()Gets the message parameters to be used when parsing i18n messages | 
| ValidatorContext | getValidatorContext()Gets the validation context used | 
| String | getValidatorType()Gets the validator type used (see class javadoc). | 
| boolean | isShortCircuit()Gets whether this field validator should short circuit the validator queue
 it's in if validation fails. | 
| protected Object | parse(String expression,
     Class type)Parse  expressionpassed in against value stack. | 
| void | setDefaultMessage(String message)Sets the default message to use for validation failure | 
| void | setMessageKey(String key)Sets a resource bundle key to be used for lookup of validation failure message | 
| void | setMessageParameters(String[] messageParameters)Sets the message parameters to be used when parsing i18n messages | 
| void | setShortCircuit(boolean shortcircuit)Sets whether this field validator should short circuit the validator queue
 it's in if validation fails. | 
| void | setTextProviderFactory(TextProviderFactory textProviderFactory) | 
| 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 parameters | 
public static final String EMPTY_STRING
protected String defaultMessage
protected String messageKey
protected ValueStack stack
protected TextProviderFactory textProviderFactory
public void setTextProviderFactory(TextProviderFactory textProviderFactory)
public void setValueStack(ValueStack stack)
ValidatorsetValueStack in interface Validatorstack - The value stack for the requestpublic void setDefaultMessage(String message)
ValidatorsetDefaultMessage in interface Validatormessage - the default messagepublic String getDefaultMessage()
ValidatorgetDefaultMessage in interface Validatorpublic String getMessage(Object object)
ValidatorgetMessage in interface Validatorobject - object being validated (eg. a domain model object)public void setMessageKey(String key)
ValidatorsetMessageKey in interface Validatorkey - the resource bundle keypublic String getMessageKey()
ValidatorgetMessageKey in interface Validatorpublic String[] getMessageParameters()
ValidatorgetMessageParameters in interface Validatorpublic void setMessageParameters(String[] messageParameters)
ValidatorsetMessageParameters in interface ValidatormessageParameters - the message parameterspublic void setShortCircuit(boolean shortcircuit)
ShortCircuitableValidatorsetShortCircuit in interface ShortCircuitableValidatorshortcircuit - true if this field validator should short circuit on
                     failure, false otherwisepublic boolean isShortCircuit()
ShortCircuitableValidatorisShortCircuit in interface ShortCircuitableValidatorpublic void setValidatorContext(ValidatorContext validatorContext)
ValidatorsetValidatorContext in interface ValidatorvalidatorContext - the validation context to use.public ValidatorContext getValidatorContext()
ValidatorgetValidatorContext in interface Validatorpublic void setValidatorType(String type)
ValidatorsetValidatorType in interface Validatortype - the type to use.public String getValidatorType()
ValidatorgetValidatorType in interface Validatorprotected Object parse(String expression, Class type)
expression passed in against value stack.expression - an OGNL expressiontype - type to returnprotected Object getFieldValue(String name, Object object) throws ValidationException
name from object,
 object should have the appropriate getter/setter.name - name of the fieldobject - to search field name onValidationException - in case of validation problemsprotected void addActionError(Object object)
Copyright © 2000–2025 Apache Software Foundation. All rights reserved.