org.apache.cocoon.forms.samples
Class CustomBirthDateValidator

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.forms.samples.CustomBirthDateValidator
All Implemented Interfaces:
LogEnabled, WidgetValidator

public class CustomBirthDateValidator
extends AbstractLogEnabled
implements WidgetValidator

Example of a custom validator. Check that the given date is a valid birth date, i.e. is at least 5 years before current date and no more than 100 years old.


Constructor Summary
CustomBirthDateValidator()
           
 
Method Summary
 boolean validate(Widget widget)
          Validate a widget.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomBirthDateValidator

public CustomBirthDateValidator()
Method Detail

validate

public boolean validate(Widget widget)
Description copied from interface: WidgetValidator
Validate a widget.

Specified by:
validate in interface WidgetValidator
Parameters:
widget - the widget to validate
Returns:
true if validation was successful. If not, the validator must have set a ValidationError on the widget or one of its children.
See Also:
WidgetValidator.validate(org.apache.cocoon.forms.formmodel.Widget)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.