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

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

public class LengthRangeStringCondition
extends AbstractStringCondition

An AbstractStringCondition implementation that checks that a given string is within a specific length range.

Author:
Uri Boness

Field Summary
 
Fields inherited from class org.springmodules.validation.util.condition.string.AbstractStringCondition
EMPTY_STRING
 
Constructor Summary
LengthRangeStringCondition(int minLength, int maxLength)
          Constructs a new LengthRangeStringCondition with given min and max range boundries.
 
Method Summary
protected  boolean checkString(String text)
          Checks that the given text is within the range defined by this condition.
 int getMaxLength()
          Returns the maximum length of the range.
 int getMinLength()
          Returns the minimum length of the range.
 
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

LengthRangeStringCondition

public LengthRangeStringCondition(int minLength,
                                  int maxLength)
Constructs a new LengthRangeStringCondition with given min and max range boundries.

Parameters:
minLength - The minimum length of the text range.
maxLength - The maximum length of the text range.
Method Detail

checkString

protected boolean checkString(String text)
Checks that the given text is within the range defined by this condition.

Specified by:
checkString in class AbstractStringCondition
Parameters:
text - The text to be checked.
Returns:
true if the given text is within the range, false otherwise.

getMinLength

public int getMinLength()
Returns the minimum length of the range.

Returns:
The minimum length of the range.

getMaxLength

public int getMaxLength()
Returns the maximum length of the range.

Returns:
The maximum length of the range.


Copyright © 2009. All Rights Reserved.