|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.opensymphony.xwork2.validator.validators.ValidatorSupport
public abstract class ValidatorSupport
Abstract implementation of the Validator interface suitable for subclassing.
Field Summary | |
---|---|
protected java.lang.String |
defaultMessage
|
protected Logger |
log
|
protected java.lang.String |
messageKey
|
Constructor Summary | |
---|---|
ValidatorSupport()
|
Method Summary | |
---|---|
protected void |
addActionError(java.lang.Object object)
|
protected void |
addFieldError(java.lang.String propertyName,
java.lang.Object object)
|
protected java.lang.Object |
conditionalParse(java.lang.String expression)
Parse expression passed in against value stack. |
java.lang.String |
getDefaultMessage()
Gets the default message used for validation failures |
protected java.lang.Object |
getFieldValue(java.lang.String name,
java.lang.Object object)
Return the field value named name from object ,
object should have the appropriate getter/setter. |
java.lang.String |
getMessage(java.lang.Object object)
Gets the validation failure message for the given object |
java.lang.String |
getMessageKey()
Gets the resource bundle key used for lookup of validation failure message |
java.lang.String[] |
getMessageParameters()
Gets the messsage parameters to be used when parsing i18n messages |
boolean |
getParse()
|
ValidatorContext |
getValidatorContext()
Gets the validation context used |
java.lang.String |
getValidatorType()
Gets the vaildator type used (see class javadoc). |
boolean |
isShortCircuit()
Gets whether this field validator should short circuit the validator queue it's in if validation fails. |
void |
setDefaultMessage(java.lang.String message)
Sets the default message to use for validation failure |
void |
setMessageKey(java.lang.String key)
Sets a resource bundle key to be used for lookup of validation failure message |
void |
setMessageParameters(java.lang.String[] messageParameters)
Sets the messsage parameters to be used when parsing i18n messages |
void |
setParse(boolean parse)
|
void |
setShortCircuit(boolean shortcircuit)
Sets whether this field validator should short circuit the validator queue it's in if validation fails. |
void |
setValidatorContext(ValidatorContext validatorContext)
This method will be called before validate with a non-null ValidatorContext. |
void |
setValidatorType(java.lang.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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.opensymphony.xwork2.validator.Validator |
---|
validate |
Field Detail |
---|
protected final Logger log
protected java.lang.String defaultMessage
protected java.lang.String messageKey
Constructor Detail |
---|
public ValidatorSupport()
Method Detail |
---|
public void setValueStack(ValueStack stack)
Validator
setValueStack
in interface Validator
stack
- The value stack for the requestpublic void setDefaultMessage(java.lang.String message)
Validator
setDefaultMessage
in interface Validator
message
- the default messagepublic java.lang.String getDefaultMessage()
Validator
getDefaultMessage
in interface Validator
public void setParse(boolean parse)
public boolean getParse()
public java.lang.String getMessage(java.lang.Object object)
Validator
getMessage
in interface Validator
object
- object being validated (eg. a domain model object)
public void setMessageKey(java.lang.String key)
Validator
setMessageKey
in interface Validator
key
- the resource bundle keypublic java.lang.String getMessageKey()
Validator
getMessageKey
in interface Validator
public java.lang.String[] getMessageParameters()
Validator
getMessageParameters
in interface Validator
public void setMessageParameters(java.lang.String[] messageParameters)
Validator
setMessageParameters
in interface Validator
messageParameters
- the messsage parameterspublic void setShortCircuit(boolean shortcircuit)
ShortCircuitableValidator
setShortCircuit
in interface ShortCircuitableValidator
shortcircuit
- true if this field validator should short circuit on
failure, false otherwisepublic boolean isShortCircuit()
ShortCircuitableValidator
isShortCircuit
in interface ShortCircuitableValidator
public void setValidatorContext(ValidatorContext validatorContext)
Validator
setValidatorContext
in interface Validator
validatorContext
- the validation context to use.public ValidatorContext getValidatorContext()
Validator
getValidatorContext
in interface Validator
public void setValidatorType(java.lang.String type)
Validator
setValidatorType
in interface Validator
type
- the type to use.public java.lang.String getValidatorType()
Validator
getValidatorType
in interface Validator
protected java.lang.Object conditionalParse(java.lang.String expression)
expression
passed in against value stack. Only parse
when 'parse' param is set to true, else just returns the expression unparsed.
expression
-
protected java.lang.Object getFieldValue(java.lang.String name, java.lang.Object object) throws ValidationException
name
from object
,
object
should have the appropriate getter/setter.
name
- object
-
ValidationException
protected void addActionError(java.lang.Object object)
protected void addFieldError(java.lang.String propertyName, java.lang.Object object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |