Interface TransformerRegistry
- All Superinterfaces:
AutoCloseable, Map<TransformerKey, Transformer>, Service, StaticService
Registry that stores and resolves
Transformer instances for Camel's
data type contract mechanism.
The registry maintains two separate caches to balance memory usage and lookup performance:
- static cache — holds all transformers registered at route startup; no eviction, no size limit. Contains
every transformer bound to a
DataTypepair when theCamelContextstarts. - dynamic cache — holds transformers created or registered at runtime (for example, from custom Java code or hot-deployed routes); backed by an LRU cache with a configurable size limit (default 1000 entries) to prevent unbounded growth.
resolveTransformer(TransformerKey), which searches both caches using the from/to
DataType pair encoded in the TransformerKey.- See Also:
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoidcleanUp()Cleanup the cache (purging stale entries)intNumber of transformers in the dynamic registryintMaximum number of entries to store in the dynamic registrybooleanWhether the given transformer is stored in the dynamic cachebooleanWhether the givenTransformeris stored in the dynamic cachebooleanWhether the given transformer is stored in the static cachebooleanWhether the given transformer is stored in the static cachevoidpurge()Purges the cache (removes transformers from the dynamic cache)@Nullable TransformerLookup aTransformerin the registry which supports the transformation for the data types represented by the key.intNumber of transformers in the static registry.Methods inherited from interface Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
resolveTransformer
Lookup aTransformerin the registry which supports the transformation for the data types represented by the key.- Parameters:
key- a key represents the from/to data types to transform- Returns:
Transformerif matched, otherwise null
-
staticSize
int staticSize()Number of transformers in the static registry. -
dynamicSize
int dynamicSize()Number of transformers in the dynamic registry -
getMaximumCacheSize
int getMaximumCacheSize()Maximum number of entries to store in the dynamic registry -
purge
void purge()Purges the cache (removes transformers from the dynamic cache) -
isStatic
Whether the given transformer is stored in the static cache- Parameters:
scheme- the scheme supported by this transformer- Returns:
- true if in static cache, false if not
-
isStatic
-
isDynamic
Whether the given transformer is stored in the dynamic cache- Parameters:
scheme- the scheme supported by this transformer- Returns:
- true if in dynamic cache, false if not
-
isDynamic
Whether the givenTransformeris stored in the dynamic cache- Parameters:
from- 'from' data typeto- 'to' data type- Returns:
- true if in dynamic cache, false if not
-
cleanUp
void cleanUp()Cleanup the cache (purging stale entries)
-