com.miginfocom.property
Interface Validator<T>

All Known Implementing Classes:
NullValidator, RangeValidator, RegexValidator, SizeValidator

public interface Validator<T>

Validates an upcoming property value change with option to veto the change, exchange the value or throw an exception.


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.
 

Method Detail

validate

<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.

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.