com.miginfocom.property
Class SizeValidator<T>

java.lang.Object
  extended by com.miginfocom.property.SizeValidator<T>
All Implemented Interfaces:
Validator<T>

public class SizeValidator<T>
extends java.lang.Object
implements Validator<T>


Constructor Summary
SizeValidator(int min, int max, Result.Type resultType)
           
 
Method Summary
<T> Result<T>
validate(Result<T> previousResult, PropertyI<T> p, T value, PropertyEvent.Type type, java.lang.Integer index)
          Validates the potential setting of a new value for a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeValidator

public SizeValidator(int min,
                     int max,
                     Result.Type resultType)
Method Detail

validate

public <T> Result<T> validate(Result<T> previousResult,
                              PropertyI<T> p,
                              T value,
                              PropertyEvent.Type type,
                              java.lang.Integer index)
Description copied from interface: Validator
Validates the potential setting of a new value for a property.

Specified by:
validate in interface Validator<T>
Parameters:
previousResult - The previus result from the validator before this one. If no validator exist before this one Result.ok() will be provided. If the validation is ok this value should be returned. Never null.
p - The property that is going to recieve value.
value - The value to be set. Can be null. Should never be changed.
type - The type of value to set.
index - If the property is a CollectionProperty type that maintain element indexes this index should reflect the index of the value that was, for instance, removed.
Returns:
The result of the validation. Never null!


Copyright © 2007 MiG InfoCom AB. All Rights Reserved.