public final class MapperBuilder extends Object implements MappingInfo
Constructor and Description |
---|
MapperBuilder() |
Modifier and Type | Method and Description |
---|---|
<S,D> MapperBuilder |
addConverter(Class<S> sourceClass,
Class<D> destinationClass,
java.util.function.BiFunction<Mapper,S,D> convertionAction)
Adds new mapping implemented by converter.
|
<S,D> MapperBuilder |
addConverter(Class<S> sourceClass,
Class<D> destinationClass,
java.util.function.Function<S,D> convertionAction)
Adds new mapping implemented by converter.
|
MapperBuilder |
addConverter(Converter<?,?>... converters)
Adds new mapping implemented by converters.
|
<S,D> MapperBuilder |
addMap(Class<S> sourceClass,
Class<D> destinationClass,
DeclarativeMapSetup<S,D> mapConfiguration)
Adds new mapping defined by map.
|
MapperBuilder |
addMapAnyByConvention(MapConvention... conventions)
If two data types has no mapping defined by
addMap(java.lang.Class, java.lang.Class, com.github.erchu.beancp.DeclarativeMapSetup) or any of
addConverter methods then this convention will be used. |
Mapper |
buildMapper()
Creates map implementation from definitions.
|
boolean |
isConverterAvailable(Class sourceClass,
Class destinationClass)
Returns
true if converter is available, false otherwise. |
boolean |
isMapAvailable(Class sourceClass,
Class destinationClass)
Returns
true if map (or map convention) is available, false otherwise. |
public <S,D> MapperBuilder addMap(Class<S> sourceClass, Class<D> destinationClass, DeclarativeMapSetup<S,D> mapConfiguration) throws MapperConfigurationException
source
and destination
classes must:
DeclarativeMap.constructDestinationObjectUsing(java.util.function.Supplier)
method.S
- source object class.D
- destination object class.sourceClass
- source object class.destinationClass
- destination object class.mapConfiguration
- map configuration.MapperConfigurationException
public <S,D> MapperBuilder addConverter(Class<S> sourceClass, Class<D> destinationClass, java.util.function.Function<S,D> convertionAction) throws MapperConfigurationException
S
- source object class.D
- destination object class.sourceClass
- source object class.destinationClass
- destination object class.convertionAction
- converter action, must be thread-safe.MapperConfigurationException
public <S,D> MapperBuilder addConverter(Class<S> sourceClass, Class<D> destinationClass, java.util.function.BiFunction<Mapper,S,D> convertionAction) throws MapperConfigurationException
S
- source object class.D
- destination object class.sourceClass
- source object class.destinationClass
- destination object class.convertionAction
- converter action, must be thread-safe.MapperConfigurationException
public MapperBuilder addConverter(Converter<?,?>... converters) throws MapperConfigurationException
converters
- converters to add.MapperConfigurationException
public MapperBuilder addMapAnyByConvention(MapConvention... conventions) throws MapperConfigurationException
addMap(java.lang.Class, java.lang.Class, com.github.erchu.beancp.DeclarativeMapSetup)
or any of
addConverter
methods then this convention will be used.conventions
- convention to add.MapperConfigurationException
public Mapper buildMapper()
public boolean isMapAvailable(Class sourceClass, Class destinationClass)
MappingInfo
true
if map (or map convention) is available, false
otherwise.isMapAvailable
in interface MappingInfo
sourceClass
- source object class.destinationClass
- destination object class.true
if map (or map convention) is available, false
otherwise.public boolean isConverterAvailable(Class sourceClass, Class destinationClass)
MappingInfo
true
if converter is available, false
otherwise.isConverterAvailable
in interface MappingInfo
sourceClass
- source object class.destinationClass
- destination object class.true
if converter is available, false
otherwise.Copyright © 2014. All rights reserved.