Class Validator

All Implemented Interfaces:
AutoCloseable, CamelContextAware, Service, ShutdownableService, HasCamelContext, StatefulService, SuspendableService

public abstract class Validator extends ServiceSupport implements CamelContextAware
Validates message content against a declared DataType, as described in the Transformer and Validator documentation.

When a route declares an inputType or outputType with validate = true,

invalid reference
org.apache.camel.processor.ContractAdvice
invokes the registered Validator for that type before (or after) the route's main processing logic. If the message content does not satisfy the validator's rules, the validator should throw a ValidationException to signal the failure.

Validators are registered in the ValidatorRegistry keyed by their target DataType. Custom validators extend this abstract class and are registered via the DSL (e.g., inputType / outputType with validate = true), which wires them through

invalid reference
org.apache.camel.model.ValidatorDefinition
during route startup.
See Also: