org.srplib.validation
Class StringLengthValidator

java.lang.Object
  extended by org.srplib.validation.AbstractValidator<String>
      extended by org.srplib.validation.StringLengthValidator
All Implemented Interfaces:
Validator<String>
Direct Known Subclasses:
StringMaxLengthValidator, StringMinLengthValidator

public class StringLengthValidator
extends AbstractValidator<String>

Validator for checking if string lengths is in specified range.

Author:
Anton Pechinsky

Constructor Summary
StringLengthValidator(int minimum, int maximum)
          Creates validators with specified range.
 
Method Summary
protected  int getMaximum()
          Returns upper bound of range.
protected  int getMinimum()
          Returns lower bound of range.
protected  boolean isValid(Validatable<String> validatable)
           
protected  ValidationError newError()
           
 
Methods inherited from class org.srplib.validation.AbstractValidator
validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringLengthValidator

public StringLengthValidator(int minimum,
                             int maximum)
Creates validators with specified range.

Parameters:
minimum - minimal string length (inclusive).
maximum - maximal string length (inclusive).
Method Detail

getMinimum

protected int getMinimum()
Returns lower bound of range.

Returns:
lower bound (inclusive)

getMaximum

protected int getMaximum()
Returns upper bound of range.

Returns:
upper bound (inclusive)

isValid

protected boolean isValid(Validatable<String> validatable)
Specified by:
isValid in class AbstractValidator<String>

newError

protected ValidationError newError()
Specified by:
newError in class AbstractValidator<String>


Copyright © 2012. All Rights Reserved.