Class ExpressionClauseSupport<T>

  • All Implemented Interfaces:
    org.apache.camel.spi.ExpressionFactoryAware, org.apache.camel.spi.PredicateFactoryAware

    public class ExpressionClauseSupport<T>
    extends Object
    implements org.apache.camel.spi.ExpressionFactoryAware, org.apache.camel.spi.PredicateFactoryAware
    A support class for building expression clauses.
    • Constructor Detail

      • ExpressionClauseSupport

        public ExpressionClauseSupport​(T result)
    • Method Detail

      • expression

        public T expression​(org.apache.camel.Expression expression)
        Specify an Expression instance
      • language

        public T language​(org.apache.camel.ExpressionFactory expression)
        Specify an ExpressionFactory instance
      • constant

        public T constant​(Object value)
        Specify the constant expression value. Important: this is a fixed constant value that is only set once during starting up the route, do not use this if you want dynamic values during routing.
      • constant

        public T constant​(String value,
                          Class<?> resultType)
        Specify the constant expression value. Important: this is a fixed constant value that is only set once during starting up the route, do not use this if you want dynamic values during routing.
      • constant

        public T constant​(Object value,
                          boolean trim)
        Specify the constant expression value. Important: this is a fixed constant value that is only set once during starting up the route, do not use this if you want dynamic values during routing.
      • exchange

        public T exchange()
        An expression of the exchange
      • inMessage

        public T inMessage()
        An expression of an inbound message
      • body

        public T body()
        An expression of an inbound message body
      • body

        public T body​(Class<?> expectedType)
        An expression of an inbound message body converted to the expected type
      • header

        public T header​(String name)
        An expression of an inbound message header of the given name
      • headers

        public T headers()
        An expression of the inbound headers
      • exchangePattern

        public T exchangePattern()
        An expression of the exchange pattern
      • exchangeProperty

        public T exchangeProperty​(String name)
        An expression of an exchange property of the given name
      • exchangeProperties

        public T exchangeProperties()
        An expression of the exchange properties
      • groovy

        public T groovy​(String text)
        Evaluates a Groovy expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • js

        public T js​(String text)
        Evaluates a JavaScript expression.
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • js

        public T js​(String text,
                    Class<?> resultType)
        Evaluates an JavaScript expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • joor

        public T joor​(String text)
        Evaluates an JOOR expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • joor

        public T joor​(String text,
                      Class<?> resultType)
        Evaluates an JOOR expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text,
                    Class<?> resultType)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text,
                    String headerOrPropertyName)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        headerOrPropertyName - the name of the header or the property to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text,
                    String headerName,
                    String propertyName)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        headerName - the name of the header to apply the expression to
        propertyName - the name of the propertyName to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text,
                    Class<?> resultType,
                    String headerOrPropertyName)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        headerOrPropertyName - the name of the header or the property to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • jq

        public T jq​(String text,
                    Class<?> resultType,
                    String headerName,
                    String propertyName)
        Evaluates JQ expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        headerName - the name of the header to apply the expression to
        propertyName - the name of the propertyName to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • datasonnet

        public T datasonnet​(String text)
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text)
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          boolean suppressExceptions)
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          boolean suppressExceptions,
                          boolean allowSimple)
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          Class<?> resultType)
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          boolean suppressExceptions,
                          Class<?> resultType)
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          boolean suppressExceptions,
                          boolean allowSimple,
                          Class<?> resultType)
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpath

        public T jsonpath​(String text,
                          boolean suppressExceptions,
                          boolean allowSimple,
                          Class<?> resultType,
                          String headerName)
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        resultType - the return type expected by the expression
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       Class<?> resultType)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       boolean suppressExceptions)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       boolean suppressExceptions,
                                       Class<?> resultType)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       boolean suppressExceptions,
                                       boolean allowSimple)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       boolean suppressExceptions,
                                       boolean allowSimple,
                                       String headerName)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • jsonpathWriteAsString

        public T jsonpathWriteAsString​(String text,
                                       boolean suppressExceptions,
                                       boolean allowSimple,
                                       String headerName,
                                       Class<?> resultType)
        Evaluates a Json Path expression with writeAsString enabled.
        Parameters:
        text - the expression to be evaluated
        suppressExceptions - whether to suppress exceptions such as PathNotFoundException
        allowSimple - whether to allow in inlined simple exceptions in the json path expression
        headerName - the name of the header to apply the expression to
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • jsonpathUnpack

        public T jsonpathUnpack​(String text,
                                Class<?> resultType)
        Evaluates a Json Path expression with unpacking a single-element array into an object enabled.
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • ognl

        public T ognl​(String text)
        Evaluates an OGNL expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • python

        public T python​(String text)
        Evaluates a Python expression.
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • python

        public T python​(String text,
                        Class<?> resultType)
        Evaluates Python expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • mvel

        public T mvel​(String text)
        Evaluates a MVEL expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • ref

        public T ref​(String ref)
        Evaluates a Expression by looking up existing Expression from the Registry
        Parameters:
        ref - refers to the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • spel

        public T spel​(String text)
        Evaluates an SpEL expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • csimple

        public T csimple​(String text)
        Evaluates a compiled simple expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • csimple

        public T csimple​(String text,
                         Class<?> resultType)
        Evaluates a compiled simple expression
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • simple

        public T simple​(String text)
        Evaluates a Simple expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • simple

        public T simple​(String text,
                        Class<?> resultType)
        Evaluates a Simple expression
        Parameters:
        text - the expression to be evaluated
        resultType - the result type
        Returns:
        the builder to continue processing the DSL
      • hl7terser

        public T hl7terser​(String text)
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token)
        Evaluates a token expression on the message body
        Parameters:
        token - the token
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          int group)
        Evaluates a token expression on the message body
        Parameters:
        token - the token
        group - to group by the given number
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          int group,
                          boolean skipFirst)
        Evaluates a token expression on the message body
        Parameters:
        token - the token
        group - to group by the given number
        skipFirst - whether to skip the very first element
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          boolean regex)
        Evaluates a token expression on the message body
        Parameters:
        token - the token
        regex - whether the token is a regular expression or not
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          boolean regex,
                          int group)
        Evaluates a token expression on the message body
        Parameters:
        token - the token
        regex - whether the token is a regular expression or not
        group - to group by the given number
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex,
                          int group)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        group - to group by number of parts
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex,
                          boolean skipFirst)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        skipFirst - whether to skip the very first element
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex,
                          int group,
                          boolean skipFirst)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        group - to group by number of parts
        skipFirst - whether to skip the very first element
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex,
                          String group,
                          boolean skipFirst)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        group - to group by number of parts
        skipFirst - whether to skip the very first element
        Returns:
        the builder to continue processing the DSL
      • tokenize

        public T tokenize​(String token,
                          String headerName,
                          boolean regex,
                          String group,
                          String groupDelimiter,
                          boolean skipFirst)
        Evaluates a token expression on the given header
        Parameters:
        token - the token
        headerName - name of header to tokenize
        regex - whether the token is a regular expression or not
        group - to group by number of parts
        groupDelimiter - delimiter to use when grouping
        skipFirst - whether to skip the very first element
        Returns:
        the builder to continue processing the DSL
      • tokenizePair

        public T tokenizePair​(String startToken,
                              String endToken,
                              boolean includeTokens)
        Evaluates a token pair expression on the message body
        Parameters:
        startToken - the start token
        endToken - the end token
        includeTokens - whether to include tokens
        Returns:
        the builder to continue processing the DSL
      • tokenizeXMLPair

        public T tokenizeXMLPair​(String tagName,
                                 String inheritNamespaceTagName,
                                 int group)
        Evaluates a token pair expression on the message body with XML content
        Parameters:
        tagName - the tag name of the child nodes to tokenize
        inheritNamespaceTagName - optional parent or root tag name that contains namespace(s) to inherit
        group - to group by the given number
        Returns:
        the builder to continue processing the DSL
      • tokenizeXMLPair

        public T tokenizeXMLPair​(String tagName,
                                 String inheritNamespaceTagName,
                                 String group)
        Evaluates a token pair expression on the message body with XML content
        Parameters:
        tagName - the tag name of the child nodes to tokenize
        inheritNamespaceTagName - optional parent or root tag name that contains namespace(s) to inherit
        group - to group by the given number
        Returns:
        the builder to continue processing the DSL
      • xtokenize

        public T xtokenize​(String path,
                           char mode,
                           org.apache.camel.support.builder.Namespaces namespaces,
                           int group)
        Evaluates an XML token expression on the message body with XML content
        Parameters:
        path - the xpath like path notation specifying the child nodes to tokenize
        mode - one of 'i', 'w', or 'u' to inject the namespaces to the token, to wrap the token with its ancestor contet, or to unwrap to its element child
        namespaces - the namespace map to the namespace bindings
        group - to group by the given number
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text)
        Evaluates an XPath expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       String headerName)
        Evaluates an XPath expression on the supplied header name's contents
        Parameters:
        text - the expression to be evaluated
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Class<?> resultType)
        Evaluates an XPath expression with the specified result type
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Class<?> resultType,
                       String headerName)
        Evaluates an XPath expression with the specified result type on the supplied header name's contents
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Class<?> resultType,
                       org.apache.camel.support.builder.Namespaces namespaces)
        Evaluates an XPath expression with the specified result type and set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Class<?> resultType,
                       org.apache.camel.support.builder.Namespaces namespaces,
                       String headerName)
        Evaluates an XPath expression with the specified result type and set of namespace prefixes and URIs on the supplied header name's contents
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Class<?> resultType,
                       Map<String,​String> namespaces)
        Evaluates an XPath expression with the specified result type and set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       org.apache.camel.support.builder.Namespaces namespaces)
        Evaluates an XPath expression with the specified set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xpath

        public T xpath​(String text,
                       Map<String,​String> namespaces)
        Evaluates an XPath expression with the specified set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text)
        Evaluates an XQuery expression
        Parameters:
        text - the expression to be evaluated
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        String headerName)
        Evaluates an XQuery expression
        Parameters:
        text - the expression to be evaluated
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Class<?> resultType)
        Evaluates an XQuery expression with the specified result type
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Class<?> resultType,
                        String headerName)
        Evaluates an XQuery expression with the specified result type
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Class<?> resultType,
                        org.apache.camel.support.builder.Namespaces namespaces)
        Evaluates an XQuery expression with the specified result type and set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Class<?> resultType,
                        org.apache.camel.support.builder.Namespaces namespaces,
                        String headerName)
        Evaluates an XQuery expression with the specified result type and set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        headerName - the name of the header to apply the expression to
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Class<?> resultType,
                        Map<String,​String> namespaces)
        Evaluates an XQuery expression with the specified result type and set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        resultType - the return type expected by the expression
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        org.apache.camel.support.builder.Namespaces namespaces)
        Evaluates an XQuery expression with the specified set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • xquery

        public T xquery​(String text,
                        Map<String,​String> namespaces)
        Evaluates an XQuery expression with the specified set of namespace prefixes and URIs
        Parameters:
        text - the expression to be evaluated
        namespaces - the namespace prefix and URIs to use
        Returns:
        the builder to continue processing the DSL
      • language

        public T language​(String language,
                          String expression)
        Evaluates a given language name with the expression text
        Parameters:
        language - the name of the language
        expression - the expression in the given language
        Returns:
        the builder to continue processing the DSL
      • getExpressionValue

        public org.apache.camel.Expression getExpressionValue()
      • setExpressionValue

        public void setExpressionValue​(org.apache.camel.Expression expressionValue)
      • getExpressionType

        public org.apache.camel.ExpressionFactory getExpressionType()
      • setExpressionType

        public void setExpressionType​(org.apache.camel.ExpressionFactory expressionType)
      • getExpressionFactory

        public org.apache.camel.ExpressionFactory getExpressionFactory()
        Specified by:
        getExpressionFactory in interface org.apache.camel.spi.ExpressionFactoryAware
      • getPredicateType

        public org.apache.camel.PredicateFactory getPredicateType()
      • setPredicateType

        public void setPredicateType​(org.apache.camel.PredicateFactory predicateType)
      • getPredicateFactory

        public org.apache.camel.PredicateFactory getPredicateFactory()
        Specified by:
        getPredicateFactory in interface org.apache.camel.spi.PredicateFactoryAware
      • createExpression

        protected org.apache.camel.Expression createExpression​(org.apache.camel.CamelContext camelContext)
      • configureExpression

        protected void configureExpression​(org.apache.camel.CamelContext camelContext,
                                           org.apache.camel.Expression expression)