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

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

public class MaxLengthStringCondition
extends AbstractStringCondition

An AbstractStringCondition implementation that checks whether the checked strings are not longer then a specific length.

Author:
Uri Boness

Field Summary
 
Fields inherited from class org.springmodules.validation.util.condition.string.AbstractStringCondition
EMPTY_STRING
 
Constructor Summary
MaxLengthStringCondition(int maxLength)
          Creates a new MaxLengthStringCondition with a given maximum length.
 
Method Summary
protected  boolean checkString(String text)
          Checks whether the given text is not longer than the maximum length that is associated with this condition.
 int getMaxLength()
          Returns the maximum length 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

MaxLengthStringCondition

public MaxLengthStringCondition(int maxLength)
Creates a new MaxLengthStringCondition with a given maximum length.

Parameters:
maxLength - The maximum length the checked string will be checked against.
Method Detail

checkString

protected boolean checkString(String text)
Checks whether the given text is not longer than the maximum length that is associated with this condition.

Specified by:
checkString in class AbstractStringCondition
Parameters:
text - The checked text.
Returns:
true if the given text is not longer than the maximum length associated with this condition, false otherwise.

getMaxLength

public int getMaxLength()
Returns the maximum length that is associated with this condition.

Returns:
The maximum length that is associated with this condition.


Copyright © 2009. All Rights Reserved.