Package net.sf.jguiraffe.transform
Interface Validator
-
- All Known Implementing Classes:
AbstractDecimalTransformer
,AbstractIntegerTransformer
,ChainValidator
,DateTimeTransformer
,DateTransformer
,DateTransformerBase
,DoubleTransformer
,DummyTransformer
,FloatTransformer
,IntegerTransformer
,LongTransformer
,NumberTransformerBase
,RegexValidator
,RequiredValidator
,TimeTransformer
public interface Validator
Definition of a validator interface.
Validators are objects that are able to check if given objects are valid. Often the objects to test have been obtained from user input. If validation passes on these objects, this means that the user has entered correct data.
Implementing custom validators is very simple. There is only one main validation method that has to be implemented. This method is passed the object to be tested and can perform arbitrary actions to determine the validity of this object. A
TransformerContext
object is also passed, which can be used to obtain needed system information, e.g. the current locale.- Version:
- $Id: Validator.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ValidationResult
isValid(Object o, TransformerContext ctx)
Validates the passed in object.
-
-
-
Method Detail
-
isValid
ValidationResult isValid(Object o, TransformerContext ctx)
Validates the passed in object. The returned result object should contain all information about the validation: if the object is valid and error messages if this is not the case.- Parameters:
o
- the object to testctx
- the transformer context- Returns:
- an object with the validation results
-
-