public interface JTransfo
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_TAG_WHEN_NO_TAGS
Default tag which is activated when not tags are specified in the convert call.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
convert(Object source)
Create a new domain object from the source transfer object.
|
<T> T |
convert(Object source,
T target,
String... tags)
Fill the target object with the values from the source object.
|
<T> List<T> |
convertList(List<?> source,
Class<T> targetClass,
String... tags)
Convert a list of object to the given type.
|
<T> T |
convertTo(Object source,
Class<T> targetClass,
String... tags)
Create a new domain object from the source transfer object.
|
<T> T |
findTarget(Object source,
Class<T> targetClass,
String... tags)
Get the base target (domain) object for the source (transfer) object.
|
Class<?> |
getDomainClass(Class<?> toClass)
Get domain class for transfer object.
|
Class<?> |
getToSubType(Class<?> toType,
Object domainObject)
Get the correct transfer object type for the given domain object.
|
boolean |
isToClass(Class<?> toClass)
Is the given class a transfer object class?
|
static final String DEFAULT_TAG_WHEN_NO_TAGS
<T> T convert(Object source, T target, String... tags)
This will write all values from the transfer object, other fields are not touched.
T - type of object for targetsource - source object. Should not be null.target - target object. Should not be null.tags - tags which indicate which fields can be converted based on MapOnly annotations.
Tags are processed from left to right.Object convert(Object source)
When the source is null, the result is also null.
The object finders are used to build the object to copy to.
source - source transfer object<T> T convertTo(Object source, Class<T> targetClass, String... tags)
When the source is null, the result is also null.
The object finders are used to build the object to copy to.
T - type of object for targetsource - source transfer objecttargetClass - target class to convert totags - tags which indicate which fields can be converted based on MapOnly annotations.
Tags are processed from left to right.<T> List<T> convertList(List<?> source, Class<T> targetClass, String... tags)
convertTo(Object, Class, String...) on each object.
When the source is null, the result is also null.
T - type of object for targetsource - source list of objectstargetClass - target class to convert each object totags - tags which indicate which fields can be converted based on MapOnly annotations.
Tags are processed from left to right.<T> T findTarget(Object source, Class<T> targetClass, String... tags)
When the source is null, the result is also null.
The object finders are used to build the object to copy to.
T - type of object for targetsource - source transfer objecttargetClass - target class to convert totags - tags which indicate how objects need to be foundClass<?> getDomainClass(Class<?> toClass)
toClass - transfer object classboolean isToClass(Class<?> toClass)
True when there is a DomainClass annotation on the class.
toClass - object class to testClass<?> getToSubType(Class<?> toType, Object domainObject)
This searches the DomainClassDelegates (if present) to see of there is a better matching transfer object than the one given as parameter.
toType - base transfer object typedomainObject - domain object (instance)Copyright © 2017. All rights reserved.