com.opensymphony.xwork.validator.validators
Class ValidatorSupport
java.lang.Object
com.opensymphony.xwork.validator.validators.ValidatorSupport
- All Implemented Interfaces:
- ShortCircuitableValidator, Validator
- Direct Known Subclasses:
- ExpressionValidator, FieldValidatorSupport
public abstract class ValidatorSupport
- extends java.lang.Object
- implements Validator, ShortCircuitableValidator
Abstract implementation of the Validator interface suitable for subclassing.
- Author:
- Jason Carreira
Field Summary |
protected java.lang.String |
defaultMessage
|
protected org.apache.commons.logging.Log |
log
|
protected java.lang.String |
messageKey
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected final org.apache.commons.logging.Log log
defaultMessage
protected java.lang.String defaultMessage
messageKey
protected java.lang.String messageKey
ValidatorSupport
public ValidatorSupport()
setDefaultMessage
public void setDefaultMessage(java.lang.String message)
- Specified by:
setDefaultMessage
in interface Validator
getDefaultMessage
public java.lang.String getDefaultMessage()
- Specified by:
getDefaultMessage
in interface Validator
getMessage
public java.lang.String getMessage(java.lang.Object object)
- Specified by:
getMessage
in interface Validator
setMessageKey
public void setMessageKey(java.lang.String key)
- Specified by:
setMessageKey
in interface Validator
getMessageKey
public java.lang.String getMessageKey()
- Specified by:
getMessageKey
in interface Validator
setShortCircuit
public void setShortCircuit(boolean shortcircuit)
- Description copied from interface:
ShortCircuitableValidator
- Sets whether this field validator should short circuit the validator queue
it's in if validation fails.
- Specified by:
setShortCircuit
in interface ShortCircuitableValidator
- Parameters:
shortcircuit
- true if this field validator should short circuit on
failure, false otherwise
isShortCircuit
public boolean isShortCircuit()
- Description copied from interface:
ShortCircuitableValidator
- Gets whether this field validator should short circuit the validator queue
it's in if validation fails.
- Specified by:
isShortCircuit
in interface ShortCircuitableValidator
- Returns:
- true if this field validator should short circuit on failure,
false otherwise
setValidatorContext
public void setValidatorContext(ValidatorContext validatorContext)
- Description copied from interface:
Validator
- This method will be called before validate with a non-null ValidatorContext.
- Specified by:
setValidatorContext
in interface Validator
getValidatorContext
public ValidatorContext getValidatorContext()
- Specified by:
getValidatorContext
in interface Validator
setValidatorType
public void setValidatorType(java.lang.String type)
- Specified by:
setValidatorType
in interface Validator
getValidatorType
public java.lang.String getValidatorType()
- Specified by:
getValidatorType
in interface Validator
getFieldValue
protected java.lang.Object getFieldValue(java.lang.String name,
java.lang.Object object)
throws ValidationException
- Throws:
ValidationException
addActionError
protected void addActionError(java.lang.Object object)
addFieldError
protected void addFieldError(java.lang.String propertyName,
java.lang.Object object)