| java.lang.Object org.iscreen.BaseValidator
All known Subclasses: org.iscreen.MockValidator, org.iscreen.validators.RegularExpressionValidator, org.iscreen.validators.NullValidator, org.iscreen.validators.DateFormatValidator, org.iscreen.validators.NumberRangeValidator, org.iscreen.validators.StringValidator,
BaseValidator | abstract public class BaseValidator implements Validator(Code) | | This abstract class acts as a base class for custom validators. Sub-classes
can extend this class to take advantage of the default implementation this
class provides.
author: Shellman, Dan |
BaseValidator | public BaseValidator()(Code) | | |
constructBeanToValidate | public Object constructBeanToValidate()(Code) | | |
getDefaultFailure | public FailureMessage getDefaultFailure()(Code) | | 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.
Returns the default failure message. |
getStringValue | protected String getStringValue(Object obj)(Code) | | Gets the object to validate as a String. This method
assumes the object is of type SimpleBean. If object is null,
this method returns null; otherwise, it returns the value
as a String.
This method would normally be called by the validate()
method like this:
public void validate( ValidatorContext context, Object beanToValidate )
{
String str;
str = getStringValue( beanToValidate );
...
}
Parameters: obj - The object being validated. Returns the object to be validated as a String. |
setDefaultFailure | public void setDefaultFailure(FailureMessage failure)(Code) | | 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.
Parameters: failure - The default failure message to use. |
|
|