com.townleyenterprises.validator
Class IntRangeValidator

java.lang.Object
  extended bycom.townleyenterprises.validator.IntRangeValidator
All Implemented Interfaces:
FieldValidator, java.io.Serializable

public class IntRangeValidator
extends java.lang.Object
implements FieldValidator

This validator takes a minimum and maximum integer value to be used for validation purposes.

Since:
3.0
Version:
$Id: IntRangeValidator.java,v 1.2 2004/08/11 16:22:11 atownley Exp $
Author:
Andrew S. Townley
See Also:
Serialized Form

Constructor Summary
IntRangeValidator()
           
 
Method Summary
 void setMax(int val, boolean inclusive)
          This method sets the maximum integer value for the range.
 void setMin(int val, boolean inclusive)
          This method sets the minimum integer value for the range.
 void validate(java.lang.Object value)
          This method validates the given value based on the implementation-defined validation rules.
 void validate(java.lang.Object value, java.util.Locale locale)
          This method validates the given value based on the implementation-defined validation rules and the specified locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntRangeValidator

public IntRangeValidator()
Method Detail

setMax

public void setMax(int val,
                   boolean inclusive)
This method sets the maximum integer value for the range.

Parameters:
val - the int value
inclusive - true to mean this value is included in the range; false otherwsie

setMin

public void setMin(int val,
                   boolean inclusive)
This method sets the minimum integer value for the range.

Parameters:
val - the int value
inclusive - true to mean this value is included in the range; false otherwsie

validate

public void validate(java.lang.Object value)
              throws java.lang.Exception
This method validates the given value based on the implementation-defined validation rules.

Specified by:
validate in interface FieldValidator
Throws:
java.lang.Exception - if the validation fails

validate

public void validate(java.lang.Object value,
                     java.util.Locale locale)
              throws java.lang.Exception
This method validates the given value based on the implementation-defined validation rules and the specified locale.

Specified by:
validate in interface FieldValidator
Throws:
java.lang.Exception - if the validation fails


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.