public interface Mapper extends MappingInfo
Modifier and Type | Method and Description |
---|---|
<S,D> D |
map(S source,
Class<D> destinationClass)
Constructs destination object and copies data from source object to newly created destination
object.
|
<S,D> void |
map(S source,
D destination)
Copies data from source object to destination object.
|
<S,D> Optional<D> |
mapIfMapperAvailable(S source,
Class<D> destinationClass)
Constructs destination object and copies data from source object to newly created destination
object.
|
<S,D> boolean |
mapIfMapperAvailable(S source,
D destination)
Copies data from source object to destination object.
|
isConverterAvailable, isMapAvailable
<S,D> void map(S source, D destination) throws MappingException
When the are more than one mapper valid for source and destination classes then mapper is chose according to priority (first option has highest priority):
MapperBuilder.addMapAnyByConvention(com.github.erchu.beancp.MapConvention...)
When there is more than one mapper of the same priority then is used the first one added to
MapperBuilder
. If no mapper available then MappingException
will be thrown.
Circular references will result in stack overflow.
S
- source object class.D
- destination object class.source
- source object.destination
- destination object.MappingException
<S,D> boolean mapIfMapperAvailable(S source, D destination) throws MappingException
When the are more than one mapper valid for source and destination classes then mapper is chose according to priority (first option has highest priority):
MapperBuilder.addMapAnyByConvention(com.github.erchu.beancp.MapConvention...)
When there is more than one mapper of the same priority then is used the first one added to
MapperBuilder
. If no mapper available then will return false{code}, otherwise
return true{code}.
Circular references will result in stack overflow.
S
- source object class.D
- destination object class.source
- source object.destination
- destination object.MappingException
<S,D> D map(S source, Class<D> destinationClass) throws MappingException
DeclarativeMap.constructDestinationObjectUsing(java.util.function.Supplier)
or if
destination object builder is not available by default constructor.
When the are more than one mapper valid for source and destination classes then mapper is chose according to priority (first option has highest priority):
MapperBuilder.addMapAnyByConvention(com.github.erchu.beancp.MapConvention...)
When there is more than one mapper of the same priority then is used the first one added to
MapperBuilder
. If no mapper available then MappingException
will be thrown.
Circular references will result in stack overflow.
S
- source object class.D
- destination object class.source
- source object.destinationClass
- destination object class.MappingException
<S,D> Optional<D> mapIfMapperAvailable(S source, Class<D> destinationClass) throws MappingException
DeclarativeMap.constructDestinationObjectUsing(java.util.function.Supplier)
or if
destination object builder is not available by default constructor.
When the are more than one mapper valid for source and destination classes then mapper is chose according to priority (first option has highest priority):
MapperBuilder.addMapAnyByConvention(com.github.erchu.beancp.MapConvention...)
When there is more than one mapper of the same priority then is used the first one added to
MapperBuilder
.
Circular references will result in stack overflow.
S
- source object class.D
- destination object class.source
- source object.destinationClass
- destination object class.MappingException
Copyright © 2014. All rights reserved.