Package org.apache.camel.spi
Interface TransformerRegistry<K>
-
- Type Parameters:
K- transformer key
- All Superinterfaces:
AutoCloseable,Map<K,Transformer>,Service,StaticService
public interface TransformerRegistry<K> extends Map<K,Transformer>, StaticService
Registry to cache transformers in memory. The registry contains two caches:- static - which keeps all the transformers in the cache for the entire lifecycle
- dynamic - which keeps the transformers in a
org.apache.camel.support.LRUCacheand may evict transformers which hasn't been requested recently
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcleanUp()Cleanup the cache (purging stale entries)intdynamicSize()Number of transformers in the dynamic registryintgetMaximumCacheSize()Maximum number of entries to store in the dynamic registrybooleanisDynamic(String scheme)Whether the given transformer is stored in the dynamic cachebooleanisDynamic(DataType from, DataType to)Whether the givenTransformeris stored in the dynamic cachebooleanisStatic(String scheme)Whether the given transformer is stored in the static cachebooleanisStatic(DataType from, DataType to)Whether the given transformer is stored in the static cachevoidpurge()Purges the cache (removes transformers from the dynamic cache)TransformerresolveTransformer(K key)Lookup aTransformerin the registry which supports the transformation for the data types represented by the key.intstaticSize()Number of transformers in the static registry.-
Methods inherited from interface java.util.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 Detail
-
resolveTransformer
Transformer resolveTransformer(K key)
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
boolean isStatic(String scheme)
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
boolean isStatic(DataType from, DataType to)
Whether the given transformer is stored in the static cache- Parameters:
from- 'from' data typeto- 'to' data type- Returns:
- true if in static cache, false if not
-
isDynamic
boolean isDynamic(String scheme)
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
boolean isDynamic(DataType from, DataType to)
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)
-
-