private class CustomConverterImpl.ConvertingWrapper extends java.lang.Object implements InternalConverting
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object |
defaultValue |
private InternalConverting |
del |
private boolean |
hasDefault |
private java.lang.Object |
object |
| Constructor and Description |
|---|
ConvertingWrapper(java.lang.Object obj,
InternalConverting c) |
| Modifier and Type | Method and Description |
|---|---|
Converting |
defaultValue(java.lang.Object defVal)
The default value to use when the object cannot be converted or in case
of conversion from a
null value. |
Converting |
keysIgnoreCase()
When converting between map-like types use case-insensitive mapping of
keys.
|
void |
setConverter(Converter c)
Set the current converter.
|
Converting |
sourceAs(java.lang.Class<?> type)
Treat the source object as the specified class.
|
Converting |
sourceAsBean()
Treat the source object as a JavaBean.
|
Converting |
sourceAsDTO()
Treat the source object as a DTO even if the source object has methods or
is otherwise not recognized as a DTO.
|
Converting |
targetAs(java.lang.Class<?> cls)
Treat the target object as the specified class.
|
Converting |
targetAsBean()
Treat the target object as a JavaBean.
|
Converting |
targetAsDTO()
Treat the target object as a DTO even if it has methods or is otherwise
not recognized as a DTO.
|
<T> T |
to(java.lang.Class<T> cls)
Specify the target object type for the conversion as a class object.
|
<T> T |
to(java.lang.reflect.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. |
java.lang.String |
toString() |
Converting |
view()
Return a live view over the backing object that reflects any changes to
the original object.
|
private final InternalConverting del
private final java.lang.Object object
private volatile java.lang.Object defaultValue
private volatile boolean hasDefault
ConvertingWrapper(java.lang.Object obj,
InternalConverting c)
public Converting view()
SpecifyingMap, Collection,
List and Set. The live view object
will cease to be live as soon as modifications are made to it. Note that
conversions to an interface or annotation will always produce a live view
that cannot be modified. This modifier has no effect with conversions to
other types.view in interface Specifying<Converting>Converting object so that additional calls
can be chained.public Converting defaultValue(java.lang.Object defVal)
Specifyingnull value.defaultValue in interface Specifying<Converting>defVal - The default value.Converting object so that additional calls
can be chained.public Converting keysIgnoreCase()
SpecifyingkeysIgnoreCase in interface Specifying<Converting>Converting object so that additional calls
can be chained.public void setConverter(Converter c)
InternalConvertingsetConverter in interface InternalConvertingc - The current converter.public Converting sourceAs(java.lang.Class<?> type)
SpecifyingsourceAs in interface Specifying<Converting>type - The class to treat the object as.Converting object so that additional calls
can be chained.public Converting sourceAsBean()
SpecifyingsourceAsBean in interface Specifying<Converting>Converting object so that additional calls
can be chained.public Converting sourceAsDTO()
SpecifyingsourceAsDTO in interface Specifying<Converting>Converting object so that additional calls
can be chained.public Converting targetAs(java.lang.Class<?> cls)
SpecifyingtargetAs in interface Specifying<Converting>cls - The class to treat the object as.Converting object so that additional calls
can be chained.public Converting targetAsBean()
SpecifyingtargetAsBean in interface Specifying<Converting>Converting object so that additional calls
can be chained.public Converting targetAsDTO()
SpecifyingtargetAsDTO in interface Specifying<Converting>Converting object so that additional calls
can be chained.public <T> T to(java.lang.Class<T> cls)
Convertingto in interface Convertingcls - The class to convert to.public <T> T to(TypeReference<T> ref)
ConvertingTypeReference. 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>>() {});
to in interface Convertingref - A type reference to the object being converted to.public <T> T to(java.lang.reflect.Type type)
Convertingto in interface Convertingtype - A Type object to represent the target type to be converted
to.public java.lang.String toString()
toString in class java.lang.Object