public interface Transformer
Definition of the Transformer
interface.
A Transformer
is 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.
Modifier and Type | Method and Description |
---|---|
Object |
transform(Object o,
TransformerContext ctx)
The main method of the
Transformer interface. |
Object transform(Object o, TransformerContext ctx) throws Exception
Transformer
interface. This method
takes the object to be transformed and returns an appropriate converted
representation of it. The also passed in TransformerContext
object can be used to access system information that may be needed for
generating the transformed representation, e.g. the actual
Locale
.o
- the object to be transformedctx
- the TransformerContext
objectException
- Transformers can throw arbitrary exceptions if the
conversion is not possibleCopyright © 2016 The JGUIraffe Team. All rights reserved.