Package org.apache.camel.spi
Interface TypeConverterRegistry
-
- All Superinterfaces:
AutoCloseable,CamelContextAware,Service,StaticService
public interface TypeConverterRegistry extends StaticService, CamelContextAware
Registry for type converters. The utilizationTypeConverterRegistry.Statisticsis by default disabled, as it has a slight performance impact under very high concurrent load. The statistics can be enabled usingTypeConverterRegistry.Statistics.setStatisticsEnabled(boolean)method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceTypeConverterRegistry.StatisticsUtilization statistics of the registry.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBulkTypeConverters(BulkTypeConverters bulkTypeConverters)Registers a new set of type converters that are bulked together into a singleBulkTypeConvertersclass.voidaddFallbackTypeConverter(TypeConverter typeConverter, boolean canPromote)Registers a new fallback type convertervoidaddTypeConverter(Class<?> toType, Class<?> fromType, TypeConverter typeConverter)Registers a new type converter.voidaddTypeConverters(Object typeConverters)Registers all the type converters from the instance, each converter must be implemented as a method and annotated withConverter.InjectorgetInjector()Gets the injectorTypeConverterRegistry.StatisticsgetStatistics()Gets the utilization statistics of this type converter registryTypeConverterExistsgetTypeConverterExists()What should happen when attempting to add a duplicate type converter.LoggingLevelgetTypeConverterExistsLoggingLevel()The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter.TypeConverterlookup(Class<?> toType, Class<?> fromType)Performs a lookup for a given type converter.booleanremoveTypeConverter(Class<?> toType, Class<?> fromType)Removes the type convertervoidsetInjector(Injector injector)Sets the injector to be used for creating new instances during type conversions.voidsetTypeConverterExists(TypeConverterExists typeConverterExists)What should happen when attempting to add a duplicate type converter.voidsetTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel)The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter.intsize()Number of type converters in the registry.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
-
-
-
Method Detail
-
addBulkTypeConverters
void addBulkTypeConverters(BulkTypeConverters bulkTypeConverters)
Registers a new set of type converters that are bulked together into a singleBulkTypeConvertersclass.
-
addTypeConverter
void addTypeConverter(Class<?> toType, Class<?> fromType, TypeConverter typeConverter)
Registers a new type converter. This method may throwTypeConverterExistsExceptionif configured to fail if an existing type converter already exists- Parameters:
toType- the type to convert tofromType- the type to convert fromtypeConverter- the type converter to use
-
removeTypeConverter
boolean removeTypeConverter(Class<?> toType, Class<?> fromType)
Removes the type converter- Parameters:
toType- the type to convert tofromType- the type to convert from- Returns:
- true if removed, false if the type converter didn't exist
-
addTypeConverters
void addTypeConverters(Object typeConverters)
Registers all the type converters from the instance, each converter must be implemented as a method and annotated withConverter.- Parameters:
typeConverters- instance which implements the type converters
-
addFallbackTypeConverter
void addFallbackTypeConverter(TypeConverter typeConverter, boolean canPromote)
Registers a new fallback type converter- Parameters:
typeConverter- the type converter to usecanPromote- whether or not the fallback type converter can be promoted to a first class type converter
-
lookup
TypeConverter lookup(Class<?> toType, Class<?> fromType)
Performs a lookup for a given type converter.- Parameters:
toType- the type to convert tofromType- the type to convert from- Returns:
- the type converter or null if not found.
-
setInjector
void setInjector(Injector injector)
Sets the injector to be used for creating new instances during type conversions.- Parameters:
injector- the injector
-
getInjector
Injector getInjector()
Gets the injector- Returns:
- the injector
-
getStatistics
TypeConverterRegistry.Statistics getStatistics()
Gets the utilization statistics of this type converter registry- Returns:
- the utilization statistics
-
size
int size()
Number of type converters in the registry.- Returns:
- number of type converters in the registry.
-
getTypeConverterExistsLoggingLevel
LoggingLevel getTypeConverterExistsLoggingLevel()
The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter. The default logging level is DEBUG
-
setTypeConverterExistsLoggingLevel
void setTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel)
The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter. The default logging level is DEBUG
-
getTypeConverterExists
TypeConverterExists getTypeConverterExists()
What should happen when attempting to add a duplicate type converter. The default behavior is to ignore the duplicate.
-
setTypeConverterExists
void setTypeConverterExists(TypeConverterExists typeConverterExists)
What should happen when attempting to add a duplicate type converter. The default behavior is to ignore the duplicate.
-
-