org.apache.camel.spi
Interface TypeConverterRegistry

All Superinterfaces:
Service, StaticService
All Known Implementing Classes:
BaseTypeConverterRegistry, DefaultTypeConverter, LazyLoadingTypeConverter

public interface TypeConverterRegistry
extends 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.

Version:

Nested Class Summary
static interface TypeConverterRegistry.Statistics
          Utilization statistics of the this registry.
 
Method Summary
 void addFallbackTypeConverter(TypeConverter typeConverter, boolean canPromote)
          Registers a new fallback type converter
 void addTypeConverter(Class<?> toType, Class<?> fromType, TypeConverter typeConverter)
          Registers a new type converter
 Injector getInjector()
          Gets the injector
 TypeConverterRegistry.Statistics getStatistics()
          Gets the utilization statistics of this type converter registry
 List<Class[]> listAllTypeConvertersFromTo()
          Gets a read-only list of the type converter from / to classes
 TypeConverter lookup(Class<?> toType, Class<?> fromType)
          Performs a lookup for a given type converter.
 boolean removeTypeConverter(Class<?> toType, Class<?> fromType)
          Removes the type converter
 void setInjector(Injector injector)
          Sets the injector to be used for creating new instances during type conversions.
 int size()
          Number of type converters in the registry.
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

addTypeConverter

void addTypeConverter(Class<?> toType,
                      Class<?> fromType,
                      TypeConverter typeConverter)
Registers a new type converter

Parameters:
toType - the type to convert to
fromType - the type to convert from
typeConverter - the type converter to use

removeTypeConverter

boolean removeTypeConverter(Class<?> toType,
                            Class<?> fromType)
Removes the type converter

Parameters:
toType - the type to convert to
fromType - the type to convert from
Returns:
true if removed, false if the type converter didn't exist

addFallbackTypeConverter

void addFallbackTypeConverter(TypeConverter typeConverter,
                              boolean canPromote)
Registers a new fallback type converter

Parameters:
typeConverter - the type converter to use
canPromote - 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 to
fromType - the type to convert from
Returns:
the type converter or null if not found.

listAllTypeConvertersFromTo

List<Class[]> listAllTypeConvertersFromTo()
Gets a read-only list of the type converter from / to classes

Returns:
a list containing fromType/toType class names

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.


Apache Camel