org.srplib.validation
Class ValueRangeValidator<T extends Comparable<T>>

java.lang.Object
  extended by org.srplib.validation.AbstractValidator<T>
      extended by org.srplib.validation.ValueRangeValidator<T>
All Implemented Interfaces:
Validator<T>

public class ValueRangeValidator<T extends Comparable<T>>
extends AbstractValidator<T>

Checks if value is in specified range.

May be applied to any subtype of Comparable.

Author:
Anton Pechinsky

Constructor Summary
ValueRangeValidator(T lowerLimit, T upperLimit)
          Creates value range validators.
 
Method Summary
protected  boolean isValid(Validatable<T> 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

ValueRangeValidator

public ValueRangeValidator(T lowerLimit,
                           T upperLimit)
Creates value range validators.

Parameters:
lowerLimit - lower limit (inclusive).
upperLimit - upper limit (inclusive).
Method Detail

isValid

protected boolean isValid(Validatable<T> validatable)
Specified by:
isValid in class AbstractValidator<T extends Comparable<T>>

newError

protected ValidationError newError()
Specified by:
newError in class AbstractValidator<T extends Comparable<T>>


Copyright © 2012. All Rights Reserved.