Package org.apache.camel.spi
Interface TypeConverterRegistry
- All Superinterfaces:
AutoCloseable,CamelContextAware,HasCamelContext,Service,StaticService
Registry for type converters.
The utilization
TypeConverterRegistry.Statistics is by default disabled, as it has a slight performance impact under very high
concurrent load. The statistics can be enabled using TypeConverterRegistry.Statistics.setStatisticsEnabled(boolean) method.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceUtilization statistics of the registry. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBulkTypeConverters(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.Gets the injectorGets the utilization statistics of this type converter registryWhat should happen when attempting to add a duplicate type converter.The logging level to use when logging that a type converter already exists when attempting to add a duplicate type converter.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
setCamelContextMethods inherited from interface org.apache.camel.spi.HasCamelContext
getCamelContext
-
Method Details
-
addBulkTypeConverters
Registers a new set of type converters that are bulked together into a singleBulkTypeConvertersclass. -
addTypeConverter
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
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
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
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
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
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
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
What should happen when attempting to add a duplicate type converter. The default behavior is to ignore the duplicate.
-