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

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.ContainsSubstringStringCondition
All Implemented Interfaces:
Condition

public class ContainsSubstringStringCondition
extends AbstractStringCondition

An AbstractStringCondition implementation that checks whether the given strings contain a specific sub-string.

Author:
Uri Boness

Field Summary
 
Fields inherited from class org.springmodules.validation.util.condition.string.AbstractStringCondition
EMPTY_STRING
 
Constructor Summary
ContainsSubstringStringCondition(String substring)
          Constructs a new ContainsSubstringStringCondition with a given sub-string.
 
Method Summary
protected  boolean checkString(String text)
          Checks whether the given text contains the sub-string associated with this condition.
 String getSubstring()
          Returns the sub-string 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

ContainsSubstringStringCondition

public ContainsSubstringStringCondition(String substring)
Constructs a new ContainsSubstringStringCondition with a given sub-string.

Parameters:
substring - The sub-string this condition will look for within the checked strings.
Method Detail

checkString

protected boolean checkString(String text)
Checks whether the given text contains the sub-string associated with this condition.

Specified by:
checkString in class AbstractStringCondition
Parameters:
text - The string to be checked.
Returns:
true if the given text contains the sub-string, false otherwise.

getSubstring

public String getSubstring()
Returns the sub-string that is associated with this condition.

Returns:
The sub-string that is associated with this condition.


Copyright © 2009. All Rights Reserved.