|
||||||||||
| 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 String |
defaultMessage
|
protected Logger |
log
|
protected String |
messageKey
|
protected ValueStack |
stack
|
| Constructor Summary | |
|---|---|
ValidatorSupport()
|
|
| Method Summary | |
|---|---|
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 name from object,
object should 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 messsage parameters to be used when parsing i18n messages |
ValidatorContext |
getValidatorContext()
Gets the validation context used |
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. |
protected Object |
parse(String expression,
Class type)
Parse expression passed 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 messsage 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 |
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 |
| 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 String defaultMessage
protected String messageKey
protected ValueStack stack
| Constructor Detail |
|---|
public ValidatorSupport()
| Method Detail |
|---|
public void setValueStack(ValueStack stack)
Validator
setValueStack in interface Validatorstack - The value stack for the requestpublic void setDefaultMessage(String message)
Validator
setDefaultMessage in interface Validatormessage - the default messagepublic String getDefaultMessage()
Validator
getDefaultMessage in interface Validatorpublic String getMessage(Object object)
Validator
getMessage in interface Validatorobject - object being validated (eg. a domain model object)
public void setMessageKey(String key)
Validator
setMessageKey in interface Validatorkey - the resource bundle keypublic String getMessageKey()
Validator
getMessageKey in interface Validatorpublic String[] getMessageParameters()
Validator
getMessageParameters in interface Validatorpublic void setMessageParameters(String[] messageParameters)
Validator
setMessageParameters in interface ValidatormessageParameters - the messsage parameterspublic void setShortCircuit(boolean shortcircuit)
ShortCircuitableValidator
setShortCircuit in interface ShortCircuitableValidatorshortcircuit - true if this field validator should short circuit on
failure, false otherwisepublic boolean isShortCircuit()
ShortCircuitableValidator
isShortCircuit in interface ShortCircuitableValidatorpublic void setValidatorContext(ValidatorContext validatorContext)
Validator
setValidatorContext in interface ValidatorvalidatorContext - the validation context to use.public ValidatorContext getValidatorContext()
Validator
getValidatorContext in interface Validatorpublic void setValidatorType(String type)
Validator
setValidatorType in interface Validatortype - the type to use.public String getValidatorType()
Validator
getValidatorType in interface Validator
protected Object parse(String expression,
Class type)
expression passed in against value stack.
expression - an OGNL expressiontype - type to return
protected 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 on
ValidationExceptionprotected void addActionError(Object object)
protected void addFieldError(String propertyName,
Object object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||