org.apache.cocoon.forms.datatype.validationruleimpl
Class EmailValidationRule

java.lang.Object
  extended byorg.apache.cocoon.forms.datatype.validationruleimpl.AbstractValidationRule
      extended byorg.apache.cocoon.forms.datatype.validationruleimpl.EmailValidationRule
All Implemented Interfaces:
ValidationRule

public class EmailValidationRule
extends AbstractValidationRule

ValidationRule that checks that a string is an email address.

Based on code copied from org.apache.commons.validator.EmailValidator.

Version:
$Id: EmailValidationRule.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Constructor Summary
EmailValidationRule()
           
 
Method Summary
protected  boolean isValidDomain(String domain)
          Returns true if the domain component of an email address is valid.
protected  boolean isValidIpAddress(org.apache.oro.text.perl.Perl5Util ipAddressMatcher)
          Validates an IP address.
protected  boolean isValidSymbolicDomain(String domain)
          Validates a symbolic domain name.
protected  boolean isValidUser(String user)
          Returns true if the user component of an email address is valid.
 boolean supportsType(Class clazz, boolean arrayType)
          Returns true if this ValidationRule supports validating objects of the same class as the one specified.
 ValidationError validate(Object value, org.outerj.expression.ExpressionContext expressionContext)
           
 
Methods inherited from class org.apache.cocoon.forms.datatype.validationruleimpl.AbstractValidationRule
evaluateComparable, evaluateNumeric, getFailMessage, hasFailMessage, setFailMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailValidationRule

public EmailValidationRule()
Method Detail

validate

public ValidationError validate(Object value,
                                org.outerj.expression.ExpressionContext expressionContext)
Parameters:
value - a value of a class supported by the ValidationRule implementation
expressionContext - many validation rules use the xReporter expression interpreter, the expressionContext allows to resolve variables used in these expressions.

supportsType

public boolean supportsType(Class clazz,
                            boolean arrayType)
Description copied from interface: ValidationRule
Returns true if this ValidationRule supports validating objects of the same class as the one specified. If the flag 'arrayType' is true, this method will return true if this validation rule can validate arrays of these objects (i.e. the object passed to the validate method will then be an array).


isValidDomain

protected boolean isValidDomain(String domain)
Returns true if the domain component of an email address is valid.

Parameters:
domain - being validatied.

isValidUser

protected boolean isValidUser(String user)
Returns true if the user component of an email address is valid.

Parameters:
user - being validated

isValidIpAddress

protected boolean isValidIpAddress(org.apache.oro.text.perl.Perl5Util ipAddressMatcher)
Validates an IP address. Returns true if valid.

Parameters:
ipAddressMatcher - Pattren matcher

isValidSymbolicDomain

protected boolean isValidSymbolicDomain(String domain)
Validates a symbolic domain name. Returns true if it's valid.

Parameters:
domain - symbolic domain name


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.