Class ValidatorBuilder


  • public class ValidatorBuilder
    extends Object
    A Java DSL which is used to build a Validator and register into CamelContext. It requires a 'type' to be specified by type() method. And then you can choose a type of validator by withUri(), withPredicate(), withJava() or withBean() method.
    • Constructor Detail

      • ValidatorBuilder

        public ValidatorBuilder()
    • Method Detail

      • type

        public ValidatorBuilder type​(String type)
        Set the data type name. If you specify 'xml:XYZ', the validator will be picked up if source type is 'xml:XYZ'. If you specify just 'xml', the validator matches with all of 'xml' source type like 'xml:ABC' or 'xml:DEF'.
        Parameters:
        type - 'from' data type name
      • type

        public ValidatorBuilder type​(Class<?> type)
        Set the data type using Java class.
        Parameters:
        type - Java class represents data type
      • withUri

        public ValidatorBuilder withUri​(String uri)
        Set the URI to be used for the endpoint Validator.
        Parameters:
        uri - endpoint URI
      • withExpression

        public ValidatorBuilder withExpression​(@AsPredicate
                                               org.apache.camel.Expression expression)
        Set the Expression to be used for the predicate Validator.
        Parameters:
        expression - validation expression
      • withExpression

        public ValidatorBuilder withExpression​(@AsPredicate
                                               org.apache.camel.Predicate predicate)
        Set the Predicate to be used for the predicate Validator.
        Parameters:
        predicate - validation predicate
      • withJava

        public ValidatorBuilder withJava​(Class<? extends org.apache.camel.spi.Validator> clazz)
        Set the Java Class represents a custom Validator implementation class.
        Parameters:
        clazz - Class object represents custom validator implementation
        See Also:
        CustomValidatorDefinition
      • configure

        public void configure​(org.apache.camel.CamelContext camelContext)
        Configures a new Validator according to the configurations built on this builder and register it into the given CamelContext.
        Parameters:
        camelContext - the given CamelContext