public class DozerTypeConverterLoader
extends org.apache.camel.support.ServiceSupport
implements org.apache.camel.CamelContextAware
DozerTypeConverterLoader
provides the mechanism for registering
a Dozer Mapper
as TypeConverter
for a CamelContext
.
While a mapper can be explicitly supplied as a parameter the
CamelContext
's registry will also be searched for Mapper
instances. A DozerTypeConverter
is created to wrap each
Mapper
instance and the mapper is queried for the types it converts.
The queried types are used to register the TypeConverter
with the
context via its TypeConverterRegistry
.Constructor and Description |
---|
DozerTypeConverterLoader()
Creates a
DozerTypeConverter performing no
TypeConverter registration. |
DozerTypeConverterLoader(org.apache.camel.CamelContext camelContext)
Creates a
DozerTypeConverter that will search the given
CamelContext for instances of Mapper . |
DozerTypeConverterLoader(org.apache.camel.CamelContext camelContext,
DozerBeanMapperConfiguration configuration)
Creates a
DozerTypeConverter using the given
DozerBeanMapperConfiguration configuration. |
Modifier and Type | Method and Description |
---|---|
protected void |
addDozerTypeConverter(org.apache.camel.spi.TypeConverterRegistry registry,
DozerTypeConverter converter,
String dozerId,
Class<?> to,
Class<?> from) |
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.CamelContext |
getCamelContext() |
com.github.dozermapper.core.Mapper |
getMapper() |
void |
init(org.apache.camel.CamelContext camelContext,
com.github.dozermapper.core.Mapper mapper)
Doses the actual querying and registration of
DozerTypeConverter s
with the CamelContext . |
protected static URL |
loadMappingFile(org.apache.camel.spi.ClassResolver classResolver,
String mappingFile) |
protected Map<String,DozerBeanMapperConfiguration> |
lookupDozerBeanMapperConfigurations()
Lookup the dozer
DozerBeanMapperConfiguration to be used. |
protected Map<String,com.github.dozermapper.core.Mapper> |
lookupDozerBeanMappers()
Lookup the dozer
Mapper to be used. |
protected void |
registerClassMaps(org.apache.camel.spi.TypeConverterRegistry registry,
String dozerId,
com.github.dozermapper.core.Mapper dozer,
List<com.github.dozermapper.core.metadata.ClassMappingMetadata> all) |
void |
setCamelContext(org.apache.camel.CamelContext camelContext)
Sets the
CamelContext and also initializes this loader. |
void |
setMapper(com.github.dozermapper.core.Mapper mapper) |
public DozerTypeConverterLoader()
DozerTypeConverter
performing no
TypeConverter
registration.public DozerTypeConverterLoader(org.apache.camel.CamelContext camelContext)
DozerTypeConverter
that will search the given
CamelContext
for instances of Mapper
. Each
discovered instance will be wrapped as a DozerTypeConverter
and
register as a TypeConverter
with the contextcamelContext
- the context to register the
DozerTypeConverter
inpublic DozerTypeConverterLoader(org.apache.camel.CamelContext camelContext, DozerBeanMapperConfiguration configuration)
DozerTypeConverter
using the given
DozerBeanMapperConfiguration
configuration.camelContext
- the context to register the
DozerTypeConverter
inconfiguration
- dozer mapping bean configuration.public void init(org.apache.camel.CamelContext camelContext, com.github.dozermapper.core.Mapper mapper)
DozerTypeConverter
s
with the CamelContext
.camelContext
- the context to register the
DozerTypeConverter
inmapper
- the DozerMapperBean to be wrapped as a type converter.protected Map<String,com.github.dozermapper.core.Mapper> lookupDozerBeanMappers()
Mapper
to be used.protected Map<String,DozerBeanMapperConfiguration> lookupDozerBeanMapperConfigurations()
DozerBeanMapperConfiguration
to be used.protected void registerClassMaps(org.apache.camel.spi.TypeConverterRegistry registry, String dozerId, com.github.dozermapper.core.Mapper dozer, List<com.github.dozermapper.core.metadata.ClassMappingMetadata> all)
protected void addDozerTypeConverter(org.apache.camel.spi.TypeConverterRegistry registry, DozerTypeConverter converter, String dozerId, Class<?> to, Class<?> from)
public org.apache.camel.CamelContext getCamelContext()
getCamelContext
in interface org.apache.camel.CamelContextAware
public void setCamelContext(org.apache.camel.CamelContext camelContext)
CamelContext
and also initializes this loader.
The reason why init(org.apache.camel.CamelContext, com.github.dozermapper.core.Mapper)
is also called
is because making using Dozer in Spring XML files easier, as no need to use the init-method attribute.setCamelContext
in interface org.apache.camel.CamelContextAware
camelContext
- the CamelContextpublic com.github.dozermapper.core.Mapper getMapper()
public void setMapper(com.github.dozermapper.core.Mapper mapper)
protected static URL loadMappingFile(org.apache.camel.spi.ClassResolver classResolver, String mappingFile)
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
Apache Camel