|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.camel.impl.ServiceSupport
org.apache.camel.impl.converter.DefaultTypeConverter
public class DefaultTypeConverter
Default implementation of a type converter registry used for type converters in Camel.
| Nested Class Summary | |
|---|---|
protected static class |
DefaultTypeConverter.TypeMapping
Represents a mapping from one type (which can be null) to another |
| Constructor Summary | |
|---|---|
DefaultTypeConverter(PackageScanClassResolver resolver,
Injector injector,
FactoryFinder factoryFinder)
|
|
| Method Summary | ||
|---|---|---|
void |
addFallbackTypeConverter(TypeConverter typeConverter)
Registers a new fallback type converter |
|
void |
addTypeConverter(Class<?> toType,
Class<?> fromType,
TypeConverter typeConverter)
Registers a new type converter |
|
|
convertTo(Class<T> type,
Exchange exchange,
Object value)
Converts the value to the specified type in the context of an exchange Used when conversion requires extra information from the current exchange (such as encoding). |
|
|
convertTo(Class<T> type,
Object value)
Converts the value to the specified type |
|
Object |
doConvertTo(Class type,
Exchange exchange,
Object value)
|
|
protected void |
doStart()
|
|
protected void |
doStop()
|
|
Set<Class<?>> |
getFromClassMappings()
|
|
Injector |
getInjector()
Gets the injector |
|
protected
|
getOrFindTypeConverter(Class<?> toType,
Object value)
|
|
Map<Class<?>,TypeConverter> |
getToClassMappings(Class<?> fromClass)
|
|
TypeConverter |
getTypeConverter(Class<?> toType,
Class<?> fromType)
|
|
List<TypeConverterLoader> |
getTypeConverterLoaders()
|
|
Map<DefaultTypeConverter.TypeMapping,TypeConverter> |
getTypeMappings()
|
|
protected void |
loadFallbackTypeConverters()
|
|
protected void |
loadTypeConverters()
Checks if the registry is loaded and if not lazily load it |
|
TypeConverter |
lookup(Class<?> toType,
Class<?> fromType)
Performs a lookup for a given type converter. |
|
|
mandatoryConvertTo(Class<T> type,
Exchange exchange,
Object value)
Converts the value to the specified type in the context of an exchange Used when conversion requires extra information from the current exchange (such as encoding). |
|
|
mandatoryConvertTo(Class<T> type,
Object value)
Converts the value to the specified type |
|
void |
setInjector(Injector injector)
Sets the injector to be used for creating new instances during type convertions. |
|
| Methods inherited from class org.apache.camel.impl.ServiceSupport |
|---|
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultTypeConverter(PackageScanClassResolver resolver,
Injector injector,
FactoryFinder factoryFinder)
| Method Detail |
|---|
public List<TypeConverterLoader> getTypeConverterLoaders()
public <T> T convertTo(Class<T> type,
Object value)
TypeConverter
convertTo in interface TypeConvertertype - the requested typevalue - the value to be converted
public <T> T convertTo(Class<T> type,
Exchange exchange,
Object value)
TypeConverter
convertTo in interface TypeConvertertype - the requested typeexchange - the current exchangevalue - the value to be converted
public <T> T mandatoryConvertTo(Class<T> type,
Object value)
throws NoTypeConversionAvailableException
TypeConverter
mandatoryConvertTo in interface TypeConvertertype - the requested typevalue - the value to be converted
NoTypeConversionAvailableException - if conversion not possible
public <T> T mandatoryConvertTo(Class<T> type,
Exchange exchange,
Object value)
throws NoTypeConversionAvailableException
TypeConverter
mandatoryConvertTo in interface TypeConvertertype - the requested typeexchange - the current exchangevalue - the value to be converted
NoTypeConversionAvailableException
public Object doConvertTo(Class type,
Exchange exchange,
Object value)
public void addTypeConverter(Class<?> toType,
Class<?> fromType,
TypeConverter typeConverter)
TypeConverterRegistry
addTypeConverter in interface TypeConverterRegistrytoType - the type to convert tofromType - the type to convert fromtypeConverter - the type converter to usepublic void addFallbackTypeConverter(TypeConverter typeConverter)
TypeConverterRegistry
addFallbackTypeConverter in interface TypeConverterRegistrytypeConverter - the type converter to use
public TypeConverter getTypeConverter(Class<?> toType,
Class<?> fromType)
public Injector getInjector()
TypeConverterRegistry
getInjector in interface TypeConverterRegistrypublic void setInjector(Injector injector)
TypeConverterRegistry
setInjector in interface TypeConverterRegistrypublic Set<Class<?>> getFromClassMappings()
public Map<Class<?>,TypeConverter> getToClassMappings(Class<?> fromClass)
public Map<DefaultTypeConverter.TypeMapping,TypeConverter> getTypeMappings()
protected <T> TypeConverter getOrFindTypeConverter(Class<?> toType,
Object value)
public TypeConverter lookup(Class<?> toType,
Class<?> fromType)
TypeConverterRegistry
lookup in interface TypeConverterRegistrytoType - the type to convert tofromType - the type to convert from
protected void loadTypeConverters()
throws Exception
Exception
protected void loadFallbackTypeConverters()
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
protected void doStart()
throws Exception
doStart in class ServiceSupportException
protected void doStop()
throws Exception
doStop in class ServiceSupportException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||