public class Transformers extends Object
Transformer
instances to perform conversions.
This class is automatically utilized by Composable
but kept public in case custom implementations need to
access this functionality.
Constructor and Description |
---|
Transformers() |
Modifier and Type | Method and Description |
---|---|
<T> boolean |
canMake(Object source,
Class<T> target)
Determines if the given object can be transformed into the given target type.
|
<T> T |
make(Object source,
Class<T> target)
Tries to transform the given object to match the given target type.
|
public <T> boolean canMake(Object source, Class<T> target)
T
- the generic type of the targetsource
- the object to transformtarget
- the target typepublic <T> T make(Object source, Class<T> target)
The class is only transformed if it implements the Transformable
interface.
Transformations are done recursively until a matching transformation happens or the class tried
to transform does not implement the Transformable
interface.
T
- the generic type of the targetsource
- the object to transformtarget
- the target typeCopyright © 2018. All rights reserved.