Interface TransformerRegistry

All Superinterfaces:
AutoCloseable, Map<TransformerKey, Transformer>, Service, StaticService

public interface TransformerRegistry extends Map<TransformerKey, Transformer>, 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 DataType pair when the CamelContext starts.
  • 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.
Lookup is performed by resolveTransformer(TransformerKey), which searches both caches using the from/to DataType pair encoded in the TransformerKey.
See Also:
  • Method Details

    • resolveTransformer

      @Nullable Transformer resolveTransformer(TransformerKey key)
      Lookup a Transformer in 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:
      Transformer if 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 type
      to - '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 given Transformer is stored in the dynamic cache
      Parameters:
      from - 'from' data type
      to - 'to' data type
      Returns:
      true if in dynamic cache, false if not
    • cleanUp

      void cleanUp()
      Cleanup the cache (purging stale entries)