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