org.iscreen
Class ValidationServiceWrapper

java.lang.Object
  extended by org.iscreen.ValidationServiceWrapper
All Implemented Interfaces:
ValidationService

public class ValidationServiceWrapper
extends java.lang.Object
implements ValidationService

This wrapper around a ValidationService is itself a ValidationService implementation. However, it can be used as a wrapper that takes a validation factory and the validation set name, bypassing the need to call the factory's getValidationService() method.

Author:
Shellman, Dan

Constructor Summary
ValidationServiceWrapper(ValidationFactoryConfig config, java.lang.String validationSetName)
          Construct the wrapper with a factory config and the ValidationSet name (the name of the service).
ValidationServiceWrapper(ValidationFactory factory, java.lang.String validationSetName)
          Construct the wrapper with an existing factory and the ValidationSet name (the name of the service).
 
Method Summary
 java.lang.String getServiceName()
          The service name (unique id) of the service.
 void validate(java.lang.Object obj)
          Called to validate an object (typically a JavaBean).
 void validate(java.lang.Object obj, java.util.Locale locale)
          Called to validate an object (typically a JavaBean).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationServiceWrapper

public ValidationServiceWrapper(ValidationFactory factory,
                                java.lang.String validationSetName)
Construct the wrapper with an existing factory and the ValidationSet name (the name of the service).

Parameters:
factory - The factory containing the validation service
validationSetName - The fully qualified name of the validation set

ValidationServiceWrapper

public ValidationServiceWrapper(ValidationFactoryConfig config,
                                java.lang.String validationSetName)
Construct the wrapper with a factory config and the ValidationSet name (the name of the service). The factory config should be completely configured prior to constructing this wrapper.

Parameters:
config - The config of the validation factory
validationSetName - The fully qualified name of the validation set
Method Detail

validate

public void validate(java.lang.Object obj)
              throws ValidationException
Description copied from interface: ValidationService
Called to validate an object (typically a JavaBean). If the object passes validation, nothing occurs (there should be no side-effects). If one or more Validators find one or more validation failures, then an exception will be thrown containing all validations failures found.

Specified by:
validate in interface ValidationService
Parameters:
obj - The object (usually a JavaBean) to validate.
Throws:
ValidationException - The exception containing any validation failures.

validate

public void validate(java.lang.Object obj,
                     java.util.Locale locale)
              throws ValidationException
Description copied from interface: ValidationService
Called to validate an object (typically a JavaBean). If the object passes validation, nothing occurs (there should be no side-effects). If one or more Validators find one or more validation failures, then an exception will be thrown containing all validations failures found.

Specified by:
validate in interface ValidationService
Parameters:
obj - The object (usually a JavaBean) to validate.
locale - The locale used for failure message generation.
Throws:
ValidationException - The exception containing any validation failures.

getServiceName

public java.lang.String getServiceName()
Description copied from interface: ValidationService
The service name (unique id) of the service. This is the fully qualified name of the Validation Set that this service represents.

Specified by:
getServiceName in interface ValidationService
Returns:
Returns the unique service name/id of this service.