Interface ValidatorRegistry

All Superinterfaces:
AutoCloseable, Map<ValidatorKey, Validator>, Service, StaticService

public interface ValidatorRegistry extends Map<ValidatorKey, Validator>, StaticService
Registry that stores and resolves Validator instances for Camel's data type validation mechanism.

The registry maintains two separate caches mirroring the design of TransformerRegistry:

  • static cache — holds all validators registered at route startup; no eviction, no size limit. Contains every validator bound to a DataType when the CamelContext starts.
  • dynamic cache — holds validators 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 resolveValidator(ValidatorKey), which searches both caches using the DataType encoded in the ValidatorKey.
See Also:
  • Method Details

    • resolveValidator

      @Nullable Validator resolveValidator(ValidatorKey key)
      Lookup a Validator in the registry which supports the validation for the data type represented by the key.
      Parameters:
      key - a key represents the data type
      Returns:
      Validator if matched, otherwise null
    • staticSize

      int staticSize()
      Number of validators in the static registry.
    • dynamicSize

      int dynamicSize()
      Number of validators in the dynamic registry
    • getMaximumCacheSize

      int getMaximumCacheSize()
      Maximum number of entries to store in the dynamic registry
    • purge

      void purge()
      Purges the cache (removes validators from the dynamic cache)
    • isStatic

      boolean isStatic(DataType type)
      Whether the given Validator is stored in the static cache
      Parameters:
      type - the data type
      Returns:
      true if in static cache, false if not
    • isDynamic

      boolean isDynamic(DataType type)
      Whether the given Validator is stored in the dynamic cache
      Parameters:
      type - the data type
      Returns:
      true if in dynamic cache, false if not
    • cleanUp

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