org.iscreen.validators
Class NullValidator

java.lang.Object
  extended by org.iscreen.BaseValidator
      extended by org.iscreen.validators.NullValidator
All Implemented Interfaces:
Validator

public class NullValidator
extends BaseValidator

The NullValidator checks a single value and ensures that it's not null.

Author:
Shellman, Dan

Field Summary
 
Fields inherited from class org.iscreen.BaseValidator
defaultFailure
 
Constructor Summary
NullValidator()
          Default constructor.
 
Method Summary
 FailureMessage getDefaultFailure()
          Retrieves the default failure message.
 void setDefaultFailure(FailureMessage failure)
          Sets the failure message.
 void validate(ValidatorContext context, java.lang.Object beanToValidate)
          This is the method that's called to validate the "bean-to-validate." Use the passed in ValidatorContext to report validation failures, etc.
 
Methods inherited from class org.iscreen.BaseValidator
constructBeanToValidate, getStringValue, getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullValidator

public NullValidator()
Default constructor.

Method Detail

validate

public void validate(ValidatorContext context,
                     java.lang.Object beanToValidate)
Description copied from interface: Validator
This is the method that's called to validate the "bean-to-validate." Use the passed in ValidatorContext to report validation failures, etc. The passed-in "bean-to-validate" is the same instance returned from the call to constructBeanToValidate(), but with all of the appropriate properties set (based upon the configured mapping).

Parameters:
context - The ValidatorContext, which is used to report failures.
beanToValidate - The JavaBean to validate.

getDefaultFailure

public FailureMessage getDefaultFailure()
Retrieves the default failure message. If only one failure is used by the sub-class, then this property can be used to get the failure message for reporting a failure.

Overrides:
getDefaultFailure in class BaseValidator
Returns:
Returns the default failure message.

setDefaultFailure

public void setDefaultFailure(FailureMessage failure)
Sets the failure message. This is called based upon what's configured for this validator. Ensure that this is properly configured: otherwise, the call to getDefaultFailure() will return null.

Overrides:
setDefaultFailure in class BaseValidator
Parameters:
failure - The default failure message to use.