com.opensymphony.xwork.validator.validators
Class VisitorFieldValidator

java.lang.Object
  extended bycom.opensymphony.xwork.validator.validators.ValidatorSupport
      extended bycom.opensymphony.xwork.validator.validators.FieldValidatorSupport
          extended bycom.opensymphony.xwork.validator.validators.VisitorFieldValidator
All Implemented Interfaces:
FieldValidator, ShortCircuitableValidator, Validator

public class VisitorFieldValidator
extends FieldValidatorSupport

The VisitorFieldValidator allows you to forward validation to object properties of your action using the object's own validation files. This allows you to use the ModelDriven development pattern and manage your validations for your models in one place, where they belong, next to your model classes. The VisitorFieldValidator can handle either simple Object properties, Collections of Objects, or Arrays.

Author:
Jason Carreira Created Aug 2, 2003 10:27:48 PM

Field Summary
 
Fields inherited from class com.opensymphony.xwork.validator.validators.ValidatorSupport
defaultMessage, log, messageKey
 
Constructor Summary
VisitorFieldValidator()
           
 
Method Summary
 String getContext()
           
 boolean isAppendPrefix()
          Flags whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs.
 void setAppendPrefix(boolean appendPrefix)
          Sets whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs.
 void setContext(String context)
           
 void validate(Object object)
          The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.
 
Methods inherited from class com.opensymphony.xwork.validator.validators.FieldValidatorSupport
getFieldName, setFieldName
 
Methods inherited from class com.opensymphony.xwork.validator.validators.ValidatorSupport
addActionError, addFieldError, getDefaultMessage, getFieldValue, getMessage, getMessageKey, getValidatorContext, isShortCircuit, setDefaultMessage, setMessageKey, setShortCircuit, setValidatorContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.opensymphony.xwork.validator.Validator
getDefaultMessage, getMessage, getMessageKey, getValidatorContext, setDefaultMessage, setMessageKey, setValidatorContext
 

Constructor Detail

VisitorFieldValidator

public VisitorFieldValidator()
Method Detail

setAppendPrefix

public void setAppendPrefix(boolean appendPrefix)
Sets whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs. The default is true.


isAppendPrefix

public boolean isAppendPrefix()
Flags whether the field name of this field validator should be prepended to the field name of the visited field to determine the full field name when an error occurs. The default is true.


setContext

public void setContext(String context)

getContext

public String getContext()

validate

public void validate(Object object)
              throws ValidationException
Description copied from interface: Validator
The validation implementation must guarantee that setValidatorContext will be called with a non-null ValidatorContext before validate is called.

Parameters:
object -
Throws:
ValidationException

XWork Project Page