@ProviderType public interface Converting extends Specifying<Converting>
Converting
instance can be obtained via the
Converter
.Modifier and Type | Method and Description |
---|---|
<T> T |
to(Class<T> cls)
Specify the target object type for the conversion as a class object.
|
<T> T |
to(Type type)
Specify the target object type as a Java Reflection Type object.
|
<T> T |
to(TypeReference<T> ref)
Specify the target object type as a
TypeReference . |
defaultValue, keysIgnoreCase, sourceAs, sourceAsBean, sourceAsDTO, targetAs, targetAsBean, targetAsDTO, view
<T> T to(Class<T> cls)
T
- The type to convert to.cls
- The class to convert to.<T> T to(Type type)
T
- The type to convert to.type
- A Type object to represent the target type to be converted
to.<T> T to(TypeReference<T> ref)
TypeReference
. If the target
class carries generics information a TypeReference should be used as this
preserves the generic information whereas a Class object has this
information erased. Example use:
List<String> result = converter.convert(Arrays.asList(1, 2, 3)) .to(new TypeReference<List<String>>() { });
T
- The type to convert to.ref
- A type reference to the object being converted to.Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0