org.springmodules.validation.util.condition.string
Class RegExpStringCondition

java.lang.Object
  extended by org.springmodules.validation.util.condition.AbstractCondition
      extended by org.springmodules.validation.util.condition.TypeSpecificCondition
          extended by org.springmodules.validation.util.condition.NonNullAcceptingTypeSpecificCondition
              extended by org.springmodules.validation.util.condition.string.AbstractStringCondition
                  extended by org.springmodules.validation.util.condition.string.RegExpStringCondition
All Implemented Interfaces:
Condition
Direct Known Subclasses:
EmailStringCondition

public class RegExpStringCondition
extends AbstractStringCondition

An AbstractStringCondition implementation that checks whether the checked strings match a specific regular expression.

Author:
Uri Boness

Field Summary
 
Fields inherited from class org.springmodules.validation.util.condition.string.AbstractStringCondition
EMPTY_STRING
 
Constructor Summary
RegExpStringCondition(Pattern pattern)
          Constructs a new RegExpStringCondition with a given Pattern that the checked text will be checked against.
RegExpStringCondition(String regexp)
          Constructs a new RegExpStringCondition with a given regular expression that the checkCalendar text will be checked against.
 
Method Summary
protected  boolean checkString(String text)
          Checks whether the given text matches the regular expression that is associated with this condition.
 Pattern getPattern()
          Returns the pattern that is associated with this condition.
 String getRegExp()
          Returns the regular expression that is associated with this condition.
 
Methods inherited from class org.springmodules.validation.util.condition.string.AbstractStringCondition
doCheck
 
Methods inherited from class org.springmodules.validation.util.condition.NonNullAcceptingTypeSpecificCondition
beforeObjectChecked
 
Methods inherited from class org.springmodules.validation.util.condition.AbstractCondition
afterObjectChecked, and, check, or
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExpStringCondition

public RegExpStringCondition(String regexp)
Constructs a new RegExpStringCondition with a given regular expression that the checkCalendar text will be checked against.

Parameters:
regexp - The given regular expression.

RegExpStringCondition

public RegExpStringCondition(Pattern pattern)
Constructs a new RegExpStringCondition with a given Pattern that the checked text will be checked against.

Parameters:
pattern - The pattern that the checked text will be checked against.
Method Detail

checkString

protected boolean checkString(String text)
Checks whether the given text matches the regular expression that is associated with this condition.

Specified by:
checkString in class AbstractStringCondition
Parameters:
text - The text to be checked.
Returns:
true if the given text matches the regular expression that is associated with this condition, false otherwise.

getPattern

public Pattern getPattern()
Returns the pattern that is associated with this condition.

Returns:
The pattern that is associated with this condition.

getRegExp

public String getRegExp()
Returns the regular expression that is associated with this condition.

Returns:
The regular expression that is associated with this condition.


Copyright © 2009. All Rights Reserved.