Package net.sf.jguiraffe.transform
Interface Transformer
-
- All Known Implementing Classes:
AbstractDecimalTransformer,AbstractIntegerTransformer,DateTimeTransformer,DateTransformer,DateTransformerBase,DoubleTransformer,DummyTransformer,FloatTransformer,IntegerTransformer,LongTransformer,NumberTransformerBase,StaticTextDataTransformer,TimeTransformer,ToStringTransformer
public interface TransformerDefinition of the
Transformerinterface.A
Transformeris an object that converts a given object into a different format or type. It is completely up to a concrete implementation how this conversion works. An example would be a formatter object that creates formatted string representations for objects. The other direction (from a formatted user input to a specific Java class) could also be done by a transformer.- Version:
- $Id: Transformer.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 Objecttransform(Object o, TransformerContext ctx)The main method of theTransformerinterface.
-
-
-
Method Detail
-
transform
Object transform(Object o, TransformerContext ctx) throws Exception
The main method of theTransformerinterface. This method takes the object to be transformed and returns an appropriate converted representation of it. The also passed inTransformerContextobject can be used to access system information that may be needed for generating the transformed representation, e.g. the actualLocale.- Parameters:
o- the object to be transformedctx- theTransformerContextobject- Returns:
- the transformed instance
- Throws:
Exception- Transformers can throw arbitrary exceptions if the conversion is not possible
-
-