001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.builder;
018
019import java.util.Map;
020import java.util.function.BiFunction;
021import java.util.function.Function;
022import java.util.function.Supplier;
023
024import org.apache.camel.Exchange;
025import org.apache.camel.Expression;
026import org.apache.camel.Message;
027import org.apache.camel.builder.xml.Namespaces;
028import org.apache.camel.model.ExpressionNode;
029import org.apache.camel.model.language.ExpressionDefinition;
030import org.apache.camel.support.ExpressionAdapter;
031
032/**
033 * Represents an expression clause within the DSL which when the expression is
034 * complete the clause continues to another part of the DSL
035 * 
036 * @version 
037 */
038public class ExpressionClause<T> extends ExpressionDefinition {
039    private ExpressionClauseSupport<T> delegate;
040
041    public ExpressionClause(T result) {
042        this.delegate = new ExpressionClauseSupport<>(result);
043    }
044
045    public static <T extends ExpressionNode> ExpressionClause<T> createAndSetExpression(T result) {
046        ExpressionClause<T> clause = new ExpressionClause<>(result);
047        result.setExpression(clause);
048        return clause;
049    }
050
051    // Helper expressions
052    // -------------------------------------------------------------------------
053
054    /**
055     * Specify an {@link Expression} instance
056     */
057    public T expression(Expression expression) {
058        return delegate.expression(expression);
059    }
060
061    /**
062     * Specify the constant expression value.
063     *
064     * <b>Important:</b> this is a fixed constant value that is only set once during starting up the route,
065     * do not use this if you want dynamic values during routing.
066     */
067    public T constant(Object value) {
068        return delegate.constant(value);
069    }
070
071    /**
072     * An expression of the exchange
073     */
074    public T exchange() {
075        return delegate.exchange();
076    }
077
078    /**
079     * A functional expression of the exchange
080     */
081    public T exchange(final Function<Exchange, Object> function) {
082        return delegate.expression(new ExpressionAdapter() {
083            public Object evaluate(Exchange exchange) {
084                return function.apply(exchange);
085            }
086        });
087    }
088
089    /**
090     * An expression of an inbound message
091     */
092    public T message() {
093        return inMessage();
094    }
095
096    /**
097     * A functional expression of an inbound message
098     */
099    public T message(final Function<Message, Object> function) {
100        return inMessage(function);
101    }
102
103    /**
104     * An expression of an inbound message
105     */
106    public T inMessage() {
107        return delegate.inMessage();
108    }
109
110    /**
111     * A functional expression of an inbound message
112     */
113    public T inMessage(final Function<Message, Object> function) {
114        return delegate.expression(new ExpressionAdapter() {
115            public Object evaluate(Exchange exchange) {
116                return function.apply(exchange.getIn());
117            }
118        });
119    }
120
121    /**
122     * An expression of an outbound message
123     */
124    public T outMessage() {
125        return delegate.outMessage();
126    }
127
128    /**
129     * A functional expression of an outbound message
130     */
131    public T outMessage(final Function<Message, Object> function) {
132        return delegate.expression(new ExpressionAdapter() {
133            public Object evaluate(Exchange exchange) {
134                return function.apply(exchange.getOut());
135            }
136        });
137    }
138
139    /**
140     * An expression of an inbound message body
141     */
142    public T body() {
143        return delegate.body();
144    }
145
146    /**
147     * A functional expression of an inbound message body
148     */
149    public T body(final Function<Object, Object> function) {
150        return delegate.expression(new ExpressionAdapter() {
151            public Object evaluate(Exchange exchange) {
152                return function.apply(exchange.getIn().getBody());
153            }
154        });
155    }
156
157    /**
158     * A functional expression of an inbound message body
159     */
160    public T body(final Supplier<Object> supplier) {
161        return delegate.expression(new ExpressionAdapter() {
162            public Object evaluate(Exchange exchange) {
163                return supplier.get();
164            }
165        });
166    }
167
168    /**
169     * A functional expression of an inbound message body and headers
170     */
171    public T body(final BiFunction<Object, Map<String, Object>, Object> function) {
172        return delegate.expression(new ExpressionAdapter() {
173            public Object evaluate(Exchange exchange) {
174                return function.apply(
175                    exchange.getIn().getBody(),
176                    exchange.getIn().getHeaders());
177            }
178        });
179    }
180
181    /**
182     * An expression of an inbound message body converted to the expected type
183     */
184    public T body(Class<?> expectedType) {
185        return delegate.body(expectedType);
186    }
187
188    /**
189     * A functional expression of an inbound message body converted to the expected type
190     */
191    public <B> T body(Class<B> expectedType, final Function<B, Object> function) {
192        return delegate.expression(new ExpressionAdapter() {
193            public Object evaluate(Exchange exchange) {
194                return function.apply(exchange.getIn().getBody(expectedType));
195            }
196        });
197    }
198
199    /**
200     * A functional expression of an inbound message body converted to the expected type and headers
201     */
202    public <B> T body(Class<B> expectedType, final BiFunction<B, Map<String, Object>, Object> function) {
203        return delegate.expression(new ExpressionAdapter() {
204            public Object evaluate(Exchange exchange) {
205                return function.apply(
206                    exchange.getIn().getBody(expectedType),
207                    exchange.getIn().getHeaders());
208            }
209        });
210    }
211
212    /**
213     * An expression of an outbound message body
214     */
215    public T outBody() {
216        return delegate.outBody();
217    }
218
219    /**
220     * A functional expression of an outbound message body
221     */
222    public T outBody(final Function<Object, Object> function) {
223        return delegate.expression(new ExpressionAdapter() {
224            public Object evaluate(Exchange exchange) {
225                return function.apply(exchange.getOut().getBody());
226            }
227        });
228    }
229
230    /**
231     * A functional expression of an outbound message body and headers
232     */
233    public T outBody(final BiFunction<Object, Map<String, Object>, Object> function) {
234        return delegate.expression(new ExpressionAdapter() {
235            public Object evaluate(Exchange exchange) {
236                return function.apply(
237                    exchange.getOut().getBody(),
238                    exchange.getOut().getHeaders());
239            }
240        });
241    }
242
243    /**
244     * An expression of an outbound message body converted to the expected type
245     */
246    public T outBody(Class<?> expectedType) {
247        return delegate.outBody(expectedType);
248    }
249
250    /**
251     * A functional expression of an outbound message body converted to the expected type
252     */
253    public <B> T outBody(Class<B> expectedType, final Function<B, Object> function) {
254        return delegate.expression(new ExpressionAdapter() {
255            public Object evaluate(Exchange exchange) {
256                return function.apply(exchange.getOut().getBody(expectedType));
257            }
258        });
259    }
260
261    /**
262     * A functional expression of an outbound message body converted to the expected type and headers
263     */
264    public <B> T outBody(Class<B> expectedType, final BiFunction<B, Map<String, Object>, Object> function) {
265        return delegate.expression(new ExpressionAdapter() {
266            public Object evaluate(Exchange exchange) {
267                return function.apply(
268                    exchange.getOut().getBody(expectedType),
269                    exchange.getOut().getHeaders());
270            }
271        });
272    }
273
274    /**
275     * An expression of an inbound message header of the given name
276     */
277    public T header(String name) {
278        return delegate.header(name);
279    }
280
281    /**
282     * An expression of the inbound headers
283     */
284    public T headers() {
285        return delegate.headers();
286    }
287
288    /**
289     * An expression of an outbound message header of the given name
290     */
291    public T outHeader(String name) {
292        return delegate.outHeader(name);
293    }
294
295    /**
296     * An expression of the outbound headers
297     */
298    public T outHeaders() {
299        return delegate.outHeaders();
300    }
301
302    /**
303     * An expression of the inbound message attachments
304     */
305    public T attachments() {
306        return delegate.attachments();
307    }
308
309    /**
310     * An expression of an exchange property of the given name
311     *
312     * @deprecated use {@link #exchangeProperty(String)} instead
313     */
314    @Deprecated
315    public T property(String name) {
316        return exchangeProperty(name);
317    }
318
319    /**
320     * An expression of an exchange property of the given name
321     */
322    public T exchangeProperty(String name) {
323        return delegate.exchangeProperty(name);
324    }
325
326    /**
327     * An expression of the exchange properties
328     *
329     * @deprecated use {@link #exchangeProperties()} instead
330     */
331    @Deprecated
332    public T properties() {
333        return exchangeProperties();
334    }
335
336    /**
337     * An expression of the exchange properties
338     */
339    public T exchangeProperties() {
340        return delegate.exchangeProperties();
341    }
342
343    // Languages
344    // -------------------------------------------------------------------------
345
346    /**
347     * Evaluates an expression using the <a
348     * href="http://camel.apache.org/bean-language.html">bean language</a>
349     * which basically means the bean is invoked to determine the expression
350     * value.
351     * 
352     * @param bean the name of the bean looked up the registry
353     * @return the builder to continue processing the DSL
354     */
355    public T method(String bean) {
356        return delegate.method(bean);
357    }
358    
359    /**
360     * Evaluates an expression using the <a
361     * href="http://camel.apache.org/bean-language.html">bean language</a>
362     * which basically means the bean is invoked to determine the expression
363     * value.
364     *
365     * @param instance the instance of the bean
366     * @return the builder to continue processing the DSL
367     */
368    public T method(Object instance) {
369        return delegate.method(instance);
370    }
371
372    /**
373     * Evaluates an expression using the <a
374     * href="http://camel.apache.org/bean-language.html">bean language</a>
375     * which basically means the bean is invoked to determine the expression
376     * value.
377     * 
378     * @param beanType the Class of the bean which we want to invoke
379     * @return the builder to continue processing the DSL
380     */
381    public T method(Class<?> beanType) {
382        return delegate.method(beanType);
383    }
384
385    /**
386     * Evaluates an expression using the <a
387     * href="http://camel.apache.org/bean-language.html">bean language</a>
388     * which basically means the bean is invoked to determine the expression
389     * value.
390     * 
391     * @param bean the name of the bean looked up the registry
392     * @param method the name of the method to invoke on the bean
393     * @return the builder to continue processing the DSL
394     */
395    public T method(String bean, String method) {
396        return delegate.method(bean, method);
397    }
398    
399    /**
400     * Evaluates an expression using the <a
401     * href="http://camel.apache.org/bean-language.html">bean language</a>
402     * which basically means the bean is invoked to determine the expression
403     * value.
404     *
405     * @param instance the instance of the bean
406     * @param method the name of the method to invoke on the bean
407     * @return the builder to continue processing the DSL
408     */
409    public T method(Object instance, String method) {
410        return delegate.method(instance, method);
411    }
412
413    /**
414     * Evaluates an expression using the <a
415     * href="http://camel.apache.org/bean-language.html">bean language</a>
416     * which basically means the bean is invoked to determine the expression
417     * value.
418     * 
419     * @param beanType the Class of the bean which we want to invoke
420     * @param method the name of the method to invoke on the bean
421     * @return the builder to continue processing the DSL
422     */
423    public T method(Class<?> beanType, String method) {
424        return delegate.method(beanType, method);
425    }
426
427    /**
428     * Evaluates the <a href="http://camel.apache.org/el.html">EL
429     * Language from JSP and JSF</a> using the <a
430     * href="http://camel.apache.org/juel.html">JUEL library</a>
431     * 
432     * @param text the expression to be evaluated
433     * @return the builder to continue processing the DSL
434     */
435    @Deprecated
436    public T el(String text) {
437        return delegate.el(text);
438    }
439
440    /**
441     * Evaluates a <a href="http://camel.apache.org/groovy.html">Groovy
442     * expression</a>
443     * 
444     * @param text the expression to be evaluated
445     * @return the builder to continue processing the DSL
446     */
447    public T groovy(String text) {
448        return delegate.groovy(text);
449    }
450
451    /**
452     * Evaluates a <a
453     * href="http://camel.apache.org/java-script.html">JavaScript
454     * expression</a>
455     * 
456     * @param text the expression to be evaluated
457     * @return the builder to continue processing the DSL
458     * @deprecated JavaScript is deprecated in Java 11 onwards
459     */
460    @Deprecated
461    public T javaScript(String text) {
462        return delegate.javaScript(text);
463    }
464
465    /**
466     * Evaluates a <a
467     * href="http://camel.apache.org/jsonpath.html">Json Path
468     * expression</a>
469     *
470     * @param text the expression to be evaluated
471     * @return the builder to continue processing the DSL
472     */
473    public T jsonpath(String text) {
474        return delegate.jsonpath(text);
475    }
476
477    /**
478     * Evaluates a <a
479     * href="http://camel.apache.org/jsonpath.html">Json Path
480     * expression</a>
481     *
482     * @param text the expression to be evaluated
483     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
484     * @return the builder to continue processing the DSL
485     */
486    public T jsonpath(String text, boolean suppressExceptions) {
487        return delegate.jsonpath(text, suppressExceptions);
488    }
489
490    /**
491     * Evaluates a <a
492     * href="http://camel.apache.org/jsonpath.html">Json Path
493     * expression</a>
494     *
495     * @param text the expression to be evaluated
496     * @param resultType the return type expected by the expression
497     * @return the builder to continue processing the DSL
498     */
499    public T jsonpath(String text, Class<?> resultType) {
500        return delegate.jsonpath(text, resultType);
501    }
502
503    /**
504     * Evaluates a <a
505     * href="http://camel.apache.org/jsonpath.html">Json Path
506     * expression</a>
507     *
508     * @param text the expression to be evaluated
509     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
510     * @param resultType the return type expected by the expression
511     * @return the builder to continue processing the DSL
512     */
513    public T jsonpath(String text, boolean suppressExceptions, Class<?> resultType) {
514        return delegate.jsonpath(text, suppressExceptions, resultType);
515    }
516
517    /**
518     * Evaluates a <a
519     * href="http://camel.apache.org/jsonpath.html">Json Path
520     * expression</a>
521     *
522     * @param text the expression to be evaluated
523     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
524     * @param resultType the return type expected by the expression
525     * @param headerName the name of the header to apply the expression to
526     * @return the builder to continue processing the DSL
527     */
528    public T jsonpath(String text, boolean suppressExceptions, Class<?> resultType, String headerName) {
529        return delegate.jsonpath(text, suppressExceptions, true, resultType, headerName);
530    }
531
532    /**
533     * Evaluates a <a
534     * href="http://camel.apache.org/jsonpath.html">Json Path
535     * expression</a> with writeAsString enabled.
536     *
537     * @param text the expression to be evaluated
538     * @return the builder to continue processing the DSL
539     */
540    public T jsonpathWriteAsString(String text) {
541        return delegate.jsonpathWriteAsString(text);
542    }
543
544    /**
545     * Evaluates a <a
546     * href="http://camel.apache.org/jsonpath.html">Json Path
547     * expression</a> with writeAsString enabled.
548     *
549     * @param text the expression to be evaluated
550     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
551     * @return the builder to continue processing the DSL
552     */
553    public T jsonpathWriteAsString(String text, boolean suppressExceptions) {
554        return delegate.jsonpathWriteAsString(text, suppressExceptions);
555    }
556
557    /**
558     * Evaluates a <a
559     * href="http://camel.apache.org/jsonpath.html">Json Path
560     * expression</a> with writeAsString enabled.
561     *
562     * @param text the expression to be evaluated
563     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
564     * @param headerName the name of the header to apply the expression to
565     * @return the builder to continue processing the DSL
566     */
567    public T jsonpathWriteAsString(String text, boolean suppressExceptions, String headerName) {
568        return delegate.jsonpathWriteAsString(text, suppressExceptions, true, headerName);
569    }
570
571    /**
572     * Evaluates a <a href="http://commons.apache.org/jxpath/">JXPath expression</a>
573     * 
574     * @param text the expression to be evaluated
575     * @return the builder to continue processing the DSL
576     */
577    @Deprecated
578    public T jxpath(String text) {
579        return delegate.jxpath(text);
580    }
581
582    /**
583     * Evaluates a <a href="http://commons.apache.org/jxpath/">JXPath expression</a>
584     *
585     * @param text the expression to be evaluated
586     * @param lenient to configure whether lenient is in use or not
587     * @return the builder to continue processing the DSL
588     */
589    @Deprecated
590    public T jxpath(String text, boolean lenient) {
591        return delegate.jxpath(text, lenient);
592    }
593
594    /**
595     * Evaluates an <a href="http://camel.apache.org/ognl.html">OGNL
596     * expression</a>
597     * 
598     * @param text the expression to be evaluated
599     * @return the builder to continue processing the DSL
600     */
601    public T ognl(String text) {
602        return delegate.ognl(text);
603    }
604
605    /**
606     * Evaluates a <a href="http://camel.apache.org/mvel.html">MVEL
607     * expression</a>
608     *
609     * @param text the expression to be evaluated
610     * @return the builder to continue processing the DSL
611     */
612    public T mvel(String text) {
613        return delegate.mvel(text);
614    }
615
616    /**
617     * Evaluates a <a href="http://camel.apache.org/php.html">PHP
618     * expression</a>
619     * 
620     * @param text the expression to be evaluated
621     * @return the builder to continue processing the DSL
622     */
623    @Deprecated
624    public T php(String text) {
625        return delegate.php(text);
626    }
627
628    /**
629     * Evaluates a <a href="http://camel.apache.org/python.html">Python
630     * expression</a>
631     * 
632     * @param text the expression to be evaluated
633     * @return the builder to continue processing the DSL
634     */
635    @Deprecated
636    public T python(String text) {
637        return delegate.python(text);
638    }
639
640    /**
641     * Evaluates a <a href="http://camel.apache.org/ref-language.html">Ref
642     * expression</a>
643     * 
644     * @param ref refers to the expression to be evaluated
645     * @return the builder to continue processing the DSL
646     */
647    public T ref(String ref) {
648        return delegate.ref(ref);
649    }
650
651    /**
652     * Evaluates a <a href="http://camel.apache.org/ruby.html">Ruby
653     * expression</a>
654     *
655     * @param text the expression to be evaluated
656     * @return the builder to continue processing the DSL
657     */
658    @Deprecated
659    public T ruby(String text) {
660        return delegate.ruby(text);
661    }
662
663    /**
664     * Evaluates an <a href="http://camel.apache.org/sql.html">SQL
665     * expression</a>
666     * 
667     * @param text the expression to be evaluated
668     * @return the builder to continue processing the DSL
669     */
670    @Deprecated
671    public T sql(String text) {
672        return delegate.sql(text);
673    }
674
675    /**
676     * Evaluates a <a href="http://camel.apache.org/spel.html">SpEL
677     * expression</a>
678     * 
679     * @param text the expression to be evaluated
680     * @return the builder to continue processing the DSL
681     */
682    public T spel(String text) {
683        return delegate.spel(text);
684    }
685    
686    /**
687     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
688     * expression</a>
689     * 
690     * @param text the expression to be evaluated
691     * @return the builder to continue processing the DSL
692     */
693    public T simple(String text) {
694        return delegate.simple(text);
695    }
696
697    /**
698     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
699     * expression</a>
700     *
701     * @param text the expression to be evaluated
702     * @param resultType the result type
703     * @return the builder to continue processing the DSL
704     */
705    public T simple(String text, Class<?> resultType) {
706        return delegate.simple(text, resultType);
707    }
708
709    /**
710     * Evaluates a token expression on the message body
711     *
712     * @param token the token
713     * @return the builder to continue processing the DSL
714     */
715    public T tokenize(String token) {
716        return delegate.tokenize(token);
717    }
718
719    /**
720     * Evaluates a token expression on the message body
721     *
722     * @param token the token
723     * @param regex whether the token is a regular expression or not
724     * @return the builder to continue processing the DSL
725     */
726    public T tokenize(String token, boolean regex) {
727        return tokenize(token, regex, false);
728    }
729
730    /**
731     * Evaluates a token expression on the message body
732     *
733     * @param token the token
734     * @param regex whether the token is a regular expression or not
735     * @param skipFirst whether to skip the first element
736     * @return the builder to continue processing the DSL
737     */
738    public T tokenize(String token, boolean regex, boolean skipFirst) {
739        return delegate.tokenize(token, null, regex, skipFirst);
740    }
741
742    /**
743     * Evaluates a token expression on the message body
744     *
745     * @param token the token
746     * @param regex whether the token is a regular expression or not
747     * @param group to group by the given number
748     * @return the builder to continue processing the DSL
749     */
750    public T tokenize(String token, boolean regex, int group) {
751        return tokenize(token, regex, group, false);
752    }
753
754    /**
755     * Evaluates a token expression on the message body
756     *
757     * @param token the token
758     * @param regex whether the token is a regular expression or not
759     * @param group to group by the given number
760     * @return the builder to continue processing the DSL
761     */
762    public T tokenize(String token, boolean regex, String group) {
763        return tokenize(token, regex, group, false);
764    }
765
766    /**
767     * Evaluates a token expression on the message body
768     *
769     * @param token the token
770     * @param regex whether the token is a regular expression or not
771     * @param group to group by the given number
772     * @param skipFirst whether to skip the first element
773     * @return the builder to continue processing the DSL
774     */
775    public T tokenize(String token, boolean regex, int group, boolean skipFirst) {
776        return delegate.tokenize(token, null, regex, group, skipFirst);
777    }
778
779    /**
780     * Evaluates a token expression on the message body
781     *
782     * @param token the token
783     * @param regex whether the token is a regular expression or not
784     * @param group to group by the given number
785     * @param skipFirst whether to skip the first element
786     * @return the builder to continue processing the DSL
787     */
788    public T tokenize(String token, boolean regex, String group, boolean skipFirst) {
789        return delegate.tokenize(token, null, regex, group, skipFirst);
790    }
791
792    /**
793     * Evaluates a token expression on the message body
794     *
795     * @param token the token
796     * @param group to group by the given number
797     * @return the builder to continue processing the DSL
798     */
799    public T tokenize(String token, int group) {
800        return delegate.tokenize(token, group);
801    }
802
803    /**
804     * Evaluates a token expression on the message body
805     *
806     * @param token the token
807     * @param group to group by the given number
808     * @param skipFirst whether to skip the first element
809     * @return the builder to continue processing the DSL
810     */
811    public T tokenize(String token, int group, boolean skipFirst) {
812        return delegate.tokenize(token, group, skipFirst);
813    }
814
815    /**
816     * Evaluates a token expression on the given header
817     *
818     * @param token the token
819     * @param headerName name of header to tokenize
820     * @return the builder to continue processing the DSL
821     */
822    public T tokenize(String token, String headerName) {
823        return delegate.tokenize(token, headerName);
824    }
825
826    /**
827     * Evaluates a token expression on the given header
828     *
829     * @param token the token
830     * @param headerName name of header to tokenize
831     * @param regex whether the token is a regular expression or not
832     * @return the builder to continue processing the DSL
833     */
834    public T tokenize(String token, String headerName, boolean regex) {
835        return delegate.tokenize(token, headerName, regex);
836    }
837
838    /**
839     * Evaluates a token pair expression on the message body.
840     * <p/>
841     * Tokens is not included.
842     *
843     * @param startToken the start token
844     * @param endToken   the end token
845     * @return the builder to continue processing the DSL
846     */
847    public T tokenizePair(String startToken, String endToken) {
848        return tokenizePair(startToken, endToken, false);
849    }
850
851    /**
852     * Evaluates a token pair expression on the message body
853     *
854     * @param startToken the start token
855     * @param endToken   the end token
856     * @param includeTokens whether to include tokens
857     * @return the builder to continue processing the DSL
858     */
859    public T tokenizePair(String startToken, String endToken, boolean includeTokens) {
860        return delegate.tokenizePair(startToken, endToken, includeTokens);
861    }
862
863    /**
864     * Evaluates a XML token expression on the message body with XML content
865     *
866     * @param tagName the tag name of the child nodes to tokenize
867     * @return the builder to continue processing the DSL
868     */
869    public T tokenizeXML(String tagName) {
870        return tokenizeXML(tagName, null);
871    }
872
873    /**
874     * Evaluates a XML token expression on the message body with XML content
875     *
876     * @param tagName the tag name of the child nodes to tokenize
877     * @param group to group by the given number
878     * @return the builder to continue processing the DSL
879     */
880    public T tokenizeXML(String tagName, int group) {
881        return tokenizeXML(tagName, null, group);
882    }
883
884    /**
885     * Evaluates a token pair expression on the message body with XML content
886     *
887     * @param tagName the tag name of the child nodes to tokenize
888     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
889     * @return the builder to continue processing the DSL
890     */
891    public T tokenizeXML(String tagName, String inheritNamespaceTagName) {
892        return tokenizeXML(tagName, inheritNamespaceTagName, 0);
893    }
894
895    /**
896     * Evaluates a token pair expression on the message body with XML content
897     *
898     * @param tagName the tag name of the child nodes to tokenize
899     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
900     * @param group to group by the given number
901     * @return the builder to continue processing the DSL
902     */
903    public T tokenizeXML(String tagName, String inheritNamespaceTagName, int group) {
904        return delegate.tokenizeXMLPair(tagName, inheritNamespaceTagName, group);
905    }
906
907    public T xtokenize(String path, Namespaces namespaces) {
908        return xtokenize(path, 'i', namespaces);
909    }
910
911    public T xtokenize(String path, char mode, Namespaces namespaces) {
912        return xtokenize(path, mode, namespaces, 0);
913    }
914
915    public T xtokenize(String path, char mode, Namespaces namespaces, int group) {
916        return delegate.xtokenize(path, mode, namespaces, group);
917    }
918
919    /**
920     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
921     * expression</a>
922     * 
923     * @param text the expression to be evaluated
924     * @return the builder to continue processing the DSL
925     */
926    public T xpath(String text) {
927        return delegate.xpath(text);
928    }
929    
930
931    /**
932     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
933     * expression</a> on the supplied header name's contents
934     * 
935     * @param text the expression to be evaluated
936     * @param headerName the name of the header to apply the expression to
937     * @return the builder to continue processing the DSL
938     */
939    public T xpath(String text, String headerName) {
940        return delegate.xpath(text, headerName);
941    }
942
943    /**
944     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
945     * expression</a> with the specified result type
946     * 
947     * @param text the expression to be evaluated
948     * @param resultType the return type expected by the expression
949     * @return the builder to continue processing the DSL
950     */
951    public T xpath(String text, Class<?> resultType) {
952        return delegate.xpath(text, resultType);
953    }
954    
955    /**
956     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
957     * expression</a> with the specified result type on the supplied
958     * header name's contents
959     * 
960     * @param text the expression to be evaluated
961     * @param resultType the return type expected by the expression
962     * @param headerName the name of the header to apply the expression to
963     * @return the builder to continue processing the DSL
964     */
965    public T xpath(String text, Class<?> resultType, String headerName) {
966        return delegate.xpath(text, resultType, headerName);
967    }
968    
969    /**
970     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
971     * expression</a> with the specified result type and set of namespace
972     * prefixes and URIs
973     * 
974     * @param text the expression to be evaluated
975     * @param resultType the return type expected by the expression
976     * @param namespaces the namespace prefix and URIs to use
977     * @return the builder to continue processing the DSL
978     */
979    public T xpath(String text, Class<?> resultType, Namespaces namespaces) {
980        return delegate.xpath(text, resultType, namespaces);
981    }
982
983    /**
984     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
985     * expression</a> with the specified result type and set of namespace
986     * prefixes and URIs on the supplied header name's contents
987     * 
988     * @param text the expression to be evaluated
989     * @param resultType the return type expected by the expression
990     * @param headerName the name of the header to apply the expression to
991     * @param namespaces the namespace prefix and URIs to use
992     * 
993     * @return the builder to continue processing the DSL
994     */
995    public T xpath(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
996        return delegate.xpath(text, resultType, namespaces, headerName);
997    }
998    
999    /**
1000     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1001     * expression</a> with the specified result type and set of namespace
1002     * prefixes and URIs
1003     * 
1004     * @param text the expression to be evaluated
1005     * @param resultType the return type expected by the expression
1006     * @param namespaces the namespace prefix and URIs to use
1007     * @return the builder to continue processing the DSL
1008     */
1009    public T xpath(String text, Class<?> resultType, Map<String, String> namespaces) {
1010        return delegate.xpath(text, resultType, namespaces);
1011    }
1012
1013    /**
1014     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1015     * expression</a> with the specified set of namespace prefixes and URIs
1016     * 
1017     * @param text the expression to be evaluated
1018     * @param namespaces the namespace prefix and URIs to use
1019     * @return the builder to continue processing the DSL
1020     */
1021    public T xpath(String text, Namespaces namespaces) {
1022        return delegate.xpath(text, namespaces);
1023    }
1024
1025    /**
1026     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1027     * expression</a> with the specified set of namespace prefixes and URIs
1028     * 
1029     * @param text the expression to be evaluated
1030     * @param namespaces the namespace prefix and URIs to use
1031     * @return the builder to continue processing the DSL
1032     */
1033    public T xpath(String text, Map<String, String> namespaces) {
1034        return delegate.xpath(text, namespaces);
1035    }
1036
1037    /**
1038     * Evaluates an <a
1039     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1040     * 
1041     * @param text the expression to be evaluated
1042     * @return the builder to continue processing the DSL
1043     */
1044    public T xquery(String text) {
1045        return delegate.xquery(text);
1046    }
1047    
1048    /**
1049     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1050     * expression</a> on the supplied header name's contents
1051     * 
1052     * @param text the expression to be evaluated
1053     * @param headerName the name of the header to apply the expression to
1054     * @return the builder to continue processing the DSL
1055     */
1056    public T xquery(String text, String headerName) {
1057        return delegate.xquery(text, headerName);
1058    }
1059
1060
1061    /**
1062     * Evaluates an <a
1063     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1064     * with the specified result type
1065     * 
1066     * @param text the expression to be evaluated
1067     * @param resultType the return type expected by the expression
1068     * @return the builder to continue processing the DSL
1069     */
1070    public T xquery(String text, Class<?> resultType) {
1071        return delegate.xquery(text, resultType);
1072    }
1073    
1074    /**
1075     * Evaluates an <a
1076     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1077     * with the specified result type
1078     * 
1079     * @param text the expression to be evaluated
1080     * @param resultType the return type expected by the expression
1081     * @param headerName the name of the header to apply the expression to
1082     * @return the builder to continue processing the DSL
1083     */
1084    public T xquery(String text, Class<?> resultType, String headerName) {
1085        return delegate.xquery(text, resultType, headerName);
1086    }
1087    
1088    /**
1089     * Evaluates an <a
1090     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1091     * with the specified result type and set of namespace prefixes and URIs
1092     * 
1093     * @param text the expression to be evaluated
1094     * @param resultType the return type expected by the expression
1095     * @param namespaces the namespace prefix and URIs to use
1096     * @return the builder to continue processing the DSL
1097     */
1098    public T xquery(String text, Class<?> resultType, Namespaces namespaces) {
1099        return delegate.xquery(text, resultType, namespaces);
1100    }
1101    
1102    /**
1103     * Evaluates an <a
1104     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1105     * with the specified result type
1106     * 
1107     * @param text the expression to be evaluated
1108     * @param resultType the return type expected by the expression
1109     * @param headerName the name of the header to apply the expression to
1110     * @param namespaces the namespace prefix and URIs to use
1111     * 
1112     * @return the builder to continue processing the DSL
1113     */
1114    public T xquery(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
1115        return delegate.xquery(text, resultType, namespaces, headerName);
1116    }
1117    /**
1118     * Evaluates an <a
1119     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1120     * with the specified result type and set of namespace prefixes and URIs
1121     * 
1122     * @param text the expression to be evaluated
1123     * @param resultType the return type expected by the expression
1124     * @param namespaces the namespace prefix and URIs to use
1125     * @return the builder to continue processing the DSL
1126     */
1127    public T xquery(String text, Class<?> resultType, Map<String, String> namespaces) {
1128        return delegate.xquery(text, resultType, namespaces);
1129    }
1130
1131    /**
1132     * Evaluates an <a
1133     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1134     * with the specified set of namespace prefixes and URIs
1135     * 
1136     * @param text the expression to be evaluated
1137     * @param namespaces the namespace prefix and URIs to use
1138     * @return the builder to continue processing the DSL
1139     */
1140    public T xquery(String text, Namespaces namespaces) {
1141        return delegate.xquery(text, namespaces);
1142    }
1143
1144    /**
1145     * Evaluates an <a
1146     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1147     * with the specified set of namespace prefixes and URIs
1148     * 
1149     * @param text the expression to be evaluated
1150     * @param namespaces the namespace prefix and URIs to use
1151     * @return the builder to continue processing the DSL
1152     */
1153    public T xquery(String text, Map<String, String> namespaces) {
1154        return delegate.xquery(text, namespaces);
1155    }
1156
1157    /**
1158     * Evaluates a given language name with the expression text
1159     * 
1160     * @param language the name of the language
1161     * @param expression the expression in the given language
1162     * @return the builder to continue processing the DSL
1163     */
1164    public T language(String language, String expression) {
1165        return delegate.language(language, expression);
1166    }
1167
1168    // Properties
1169    // -------------------------------------------------------------------------
1170
1171    @Override
1172    public Expression getExpressionValue() {
1173        return delegate.getExpressionValue();
1174    }
1175
1176    @Override
1177    protected void setExpressionValue(Expression expressionValue) {
1178        delegate.setExpressionValue(expressionValue);
1179    }
1180
1181    @Override
1182    public ExpressionDefinition getExpressionType() {
1183        return delegate.getExpressionType();
1184    }
1185
1186    @Override
1187    protected void setExpressionType(ExpressionDefinition expressionType) {
1188        delegate.setExpressionType(expressionType);
1189    }
1190}