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 java.util.function.Supplier;
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    public T el(String text) {
436        return delegate.el(text);
437    }
438
439    /**
440     * Evaluates a <a href="http://camel.apache.org/groovy.html">Groovy
441     * expression</a>
442     * 
443     * @param text the expression to be evaluated
444     * @return the builder to continue processing the DSL
445     */
446    public T groovy(String text) {
447        return delegate.groovy(text);
448    }
449
450    /**
451     * Evaluates a <a
452     * href="http://camel.apache.org/java-script.html">JavaScript
453     * expression</a>
454     * 
455     * @param text the expression to be evaluated
456     * @return the builder to continue processing the DSL
457     */
458    public T javaScript(String text) {
459        return delegate.javaScript(text);
460    }
461
462    /**
463     * Evaluates a <a
464     * href="http://camel.apache.org/jsonpath.html">Json Path
465     * expression</a>
466     *
467     * @param text the expression to be evaluated
468     * @return the builder to continue processing the DSL
469     */
470    public T jsonpath(String text) {
471        return delegate.jsonpath(text);
472    }
473
474    /**
475     * Evaluates a <a
476     * href="http://camel.apache.org/jsonpath.html">Json Path
477     * expression</a>
478     *
479     * @param text the expression to be evaluated
480     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
481     * @return the builder to continue processing the DSL
482     */
483    public T jsonpath(String text, boolean suppressExceptions) {
484        return delegate.jsonpath(text, suppressExceptions);
485    }
486
487    /**
488     * Evaluates a <a
489     * href="http://camel.apache.org/jsonpath.html">Json Path
490     * expression</a>
491     *
492     * @param text the expression to be evaluated
493     * @param resultType the return type expected by the expression
494     * @return the builder to continue processing the DSL
495     */
496    public T jsonpath(String text, Class<?> resultType) {
497        return delegate.jsonpath(text, resultType);
498    }
499
500    /**
501     * Evaluates a <a
502     * href="http://camel.apache.org/jsonpath.html">Json Path
503     * expression</a>
504     *
505     * @param text the expression to be evaluated
506     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
507     * @param resultType the return type expected by the expression
508     * @return the builder to continue processing the DSL
509     */
510    public T jsonpath(String text, boolean suppressExceptions, Class<?> resultType) {
511        return delegate.jsonpath(text, suppressExceptions, resultType);
512    }
513
514    /**
515     * Evaluates a <a
516     * href="http://camel.apache.org/jsonpath.html">Json Path
517     * expression</a>
518     *
519     * @param text the expression to be evaluated
520     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
521     * @param resultType the return type expected by the expression
522     * @param headerName the name of the header to apply the expression to
523     * @return the builder to continue processing the DSL
524     */
525    public T jsonpath(String text, boolean suppressExceptions, Class<?> resultType, String headerName) {
526        return delegate.jsonpath(text, suppressExceptions, true, resultType, headerName);
527    }
528
529    /**
530     * Evaluates a <a
531     * href="http://camel.apache.org/jsonpath.html">Json Path
532     * expression</a> with writeAsString enabled.
533     *
534     * @param text the expression to be evaluated
535     * @return the builder to continue processing the DSL
536     */
537    public T jsonpathWriteAsString(String text) {
538        return delegate.jsonpathWriteAsString(text);
539    }
540
541    /**
542     * Evaluates a <a
543     * href="http://camel.apache.org/jsonpath.html">Json Path
544     * expression</a> with writeAsString enabled.
545     *
546     * @param text the expression to be evaluated
547     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
548     * @return the builder to continue processing the DSL
549     */
550    public T jsonpathWriteAsString(String text, boolean suppressExceptions) {
551        return delegate.jsonpathWriteAsString(text, suppressExceptions);
552    }
553
554    /**
555     * Evaluates a <a
556     * href="http://camel.apache.org/jsonpath.html">Json Path
557     * expression</a> with writeAsString enabled.
558     *
559     * @param text the expression to be evaluated
560     * @param suppressExceptions whether to suppress exceptions such as PathNotFoundException
561     * @param headerName the name of the header to apply the expression to
562     * @return the builder to continue processing the DSL
563     */
564    public T jsonpathWriteAsString(String text, boolean suppressExceptions, String headerName) {
565        return delegate.jsonpathWriteAsString(text, suppressExceptions, true, headerName);
566    }
567
568    /**
569     * Evaluates a <a href="http://commons.apache.org/jxpath/">JXPath expression</a>
570     * 
571     * @param text the expression to be evaluated
572     * @return the builder to continue processing the DSL
573     */
574    public T jxpath(String text) {
575        return delegate.jxpath(text);
576    }
577
578    /**
579     * Evaluates a <a href="http://commons.apache.org/jxpath/">JXPath expression</a>
580     *
581     * @param text the expression to be evaluated
582     * @param lenient to configure whether lenient is in use or not
583     * @return the builder to continue processing the DSL
584     */
585    public T jxpath(String text, boolean lenient) {
586        return delegate.jxpath(text, lenient);
587    }
588
589    /**
590     * Evaluates an <a href="http://camel.apache.org/ognl.html">OGNL
591     * expression</a>
592     * 
593     * @param text the expression to be evaluated
594     * @return the builder to continue processing the DSL
595     */
596    public T ognl(String text) {
597        return delegate.ognl(text);
598    }
599
600    /**
601     * Evaluates a <a href="http://camel.apache.org/mvel.html">MVEL
602     * expression</a>
603     *
604     * @param text the expression to be evaluated
605     * @return the builder to continue processing the DSL
606     */
607    public T mvel(String text) {
608        return delegate.mvel(text);
609    }
610
611    /**
612     * Evaluates a <a href="http://camel.apache.org/php.html">PHP
613     * expression</a>
614     * 
615     * @param text the expression to be evaluated
616     * @return the builder to continue processing the DSL
617     */
618    public T php(String text) {
619        return delegate.php(text);
620    }
621
622    /**
623     * Evaluates a <a href="http://camel.apache.org/python.html">Python
624     * expression</a>
625     * 
626     * @param text the expression to be evaluated
627     * @return the builder to continue processing the DSL
628     */
629    public T python(String text) {
630        return delegate.python(text);
631    }
632
633    /**
634     * Evaluates a <a href="http://camel.apache.org/ref-language.html">Ref
635     * expression</a>
636     * 
637     * @param ref refers to the expression to be evaluated
638     * @return the builder to continue processing the DSL
639     */
640    public T ref(String ref) {
641        return delegate.ref(ref);
642    }
643
644    /**
645     * Evaluates a <a href="http://camel.apache.org/ruby.html">Ruby
646     * expression</a>
647     *
648     * @param text the expression to be evaluated
649     * @return the builder to continue processing the DSL
650     */
651    public T ruby(String text) {
652        return delegate.ruby(text);
653    }
654
655    /**
656     * Evaluates an <a href="http://camel.apache.org/sql.html">SQL
657     * expression</a>
658     * 
659     * @param text the expression to be evaluated
660     * @return the builder to continue processing the DSL
661     */
662    public T sql(String text) {
663        return delegate.sql(text);
664    }
665
666    /**
667     * Evaluates a <a href="http://camel.apache.org/spel.html">SpEL
668     * expression</a>
669     * 
670     * @param text the expression to be evaluated
671     * @return the builder to continue processing the DSL
672     */
673    public T spel(String text) {
674        return delegate.spel(text);
675    }
676    
677    /**
678     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
679     * expression</a>
680     * 
681     * @param text the expression to be evaluated
682     * @return the builder to continue processing the DSL
683     */
684    public T simple(String text) {
685        return delegate.simple(text);
686    }
687
688    /**
689     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
690     * expression</a>
691     *
692     * @param text the expression to be evaluated
693     * @param resultType the result type
694     * @return the builder to continue processing the DSL
695     */
696    public T simple(String text, Class<?> resultType) {
697        return delegate.simple(text, resultType);
698    }
699
700    /**
701     * Evaluates a token expression on the message body
702     *
703     * @param token the token
704     * @return the builder to continue processing the DSL
705     */
706    public T tokenize(String token) {
707        return delegate.tokenize(token);
708    }
709
710    /**
711     * Evaluates a token expression on the message body
712     *
713     * @param token the token
714     * @param regex whether the token is a regular expression or not
715     * @return the builder to continue processing the DSL
716     */
717    public T tokenize(String token, boolean regex) {
718        return tokenize(token, regex, false);
719    }
720
721    /**
722     * Evaluates a token expression on the message body
723     *
724     * @param token the token
725     * @param regex whether the token is a regular expression or not
726     * @param skipFirst whether to skip the first element
727     * @return the builder to continue processing the DSL
728     */
729    public T tokenize(String token, boolean regex, boolean skipFirst) {
730        return delegate.tokenize(token, null, regex, skipFirst);
731    }
732
733    /**
734     * Evaluates a token expression on the message body
735     *
736     * @param token the token
737     * @param regex whether the token is a regular expression or not
738     * @param group to group by the given number
739     * @return the builder to continue processing the DSL
740     */
741    public T tokenize(String token, boolean regex, int group) {
742        return tokenize(token, regex, group, false);
743    }
744
745    /**
746     * Evaluates a token expression on the message body
747     *
748     * @param token the token
749     * @param regex whether the token is a regular expression or not
750     * @param group to group by the given number
751     * @return the builder to continue processing the DSL
752     */
753    public T tokenize(String token, boolean regex, String group) {
754        return tokenize(token, regex, group, false);
755    }
756
757    /**
758     * Evaluates a token expression on the message body
759     *
760     * @param token the token
761     * @param regex whether the token is a regular expression or not
762     * @param group to group by the given number
763     * @param skipFirst whether to skip the first element
764     * @return the builder to continue processing the DSL
765     */
766    public T tokenize(String token, boolean regex, int group, boolean skipFirst) {
767        return delegate.tokenize(token, null, regex, group, skipFirst);
768    }
769
770    /**
771     * Evaluates a token expression on the message body
772     *
773     * @param token the token
774     * @param regex whether the token is a regular expression or not
775     * @param group to group by the given number
776     * @param skipFirst whether to skip the first element
777     * @return the builder to continue processing the DSL
778     */
779    public T tokenize(String token, boolean regex, String group, boolean skipFirst) {
780        return delegate.tokenize(token, null, regex, group, skipFirst);
781    }
782
783    /**
784     * Evaluates a token expression on the message body
785     *
786     * @param token the token
787     * @param group to group by the given number
788     * @return the builder to continue processing the DSL
789     */
790    public T tokenize(String token, int group) {
791        return delegate.tokenize(token, group);
792    }
793
794    /**
795     * Evaluates a token expression on the message body
796     *
797     * @param token the token
798     * @param group to group by the given number
799     * @param skipFirst whether to skip the first element
800     * @return the builder to continue processing the DSL
801     */
802    public T tokenize(String token, int group, boolean skipFirst) {
803        return delegate.tokenize(token, group, skipFirst);
804    }
805
806    /**
807     * Evaluates a token expression on the given header
808     *
809     * @param token the token
810     * @param headerName name of header to tokenize
811     * @return the builder to continue processing the DSL
812     */
813    public T tokenize(String token, String headerName) {
814        return delegate.tokenize(token, headerName);
815    }
816
817    /**
818     * Evaluates a token expression on the given header
819     *
820     * @param token the token
821     * @param headerName name of header to tokenize
822     * @param regex whether the token is a regular expression or not
823     * @return the builder to continue processing the DSL
824     */
825    public T tokenize(String token, String headerName, boolean regex) {
826        return delegate.tokenize(token, headerName, regex);
827    }
828
829    /**
830     * Evaluates a token pair expression on the message body.
831     * <p/>
832     * Tokens is not included.
833     *
834     * @param startToken the start token
835     * @param endToken   the end token
836     * @return the builder to continue processing the DSL
837     */
838    public T tokenizePair(String startToken, String endToken) {
839        return tokenizePair(startToken, endToken, false);
840    }
841
842    /**
843     * Evaluates a token pair expression on the message body
844     *
845     * @param startToken the start token
846     * @param endToken   the end token
847     * @param includeTokens whether to include tokens
848     * @return the builder to continue processing the DSL
849     */
850    public T tokenizePair(String startToken, String endToken, boolean includeTokens) {
851        return delegate.tokenizePair(startToken, endToken, includeTokens);
852    }
853
854    /**
855     * Evaluates a XML token expression on the message body with XML content
856     *
857     * @param tagName the tag name of the child nodes to tokenize
858     * @return the builder to continue processing the DSL
859     */
860    public T tokenizeXML(String tagName) {
861        return tokenizeXML(tagName, null);
862    }
863
864    /**
865     * Evaluates a XML token expression on the message body with XML content
866     *
867     * @param tagName the tag name of the child nodes to tokenize
868     * @param group to group by the given number
869     * @return the builder to continue processing the DSL
870     */
871    public T tokenizeXML(String tagName, int group) {
872        return tokenizeXML(tagName, null, group);
873    }
874
875    /**
876     * Evaluates a token pair expression on the message body with XML content
877     *
878     * @param tagName the tag name of the child nodes to tokenize
879     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
880     * @return the builder to continue processing the DSL
881     */
882    public T tokenizeXML(String tagName, String inheritNamespaceTagName) {
883        return tokenizeXML(tagName, inheritNamespaceTagName, 0);
884    }
885
886    /**
887     * Evaluates a token pair expression on the message body with XML content
888     *
889     * @param tagName the tag name of the child nodes to tokenize
890     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
891     * @param group to group by the given number
892     * @return the builder to continue processing the DSL
893     */
894    public T tokenizeXML(String tagName, String inheritNamespaceTagName, int group) {
895        return delegate.tokenizeXMLPair(tagName, inheritNamespaceTagName, group);
896    }
897
898    public T xtokenize(String path, Namespaces namespaces) {
899        return xtokenize(path, 'i', namespaces);
900    }
901
902    public T xtokenize(String path, char mode, Namespaces namespaces) {
903        return xtokenize(path, mode, namespaces, 0);
904    }
905
906    public T xtokenize(String path, char mode, Namespaces namespaces, int group) {
907        return delegate.xtokenize(path, mode, namespaces, group);
908    }
909
910    /**
911     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
912     * expression</a>
913     * 
914     * @param text the expression to be evaluated
915     * @return the builder to continue processing the DSL
916     */
917    public T xpath(String text) {
918        return delegate.xpath(text);
919    }
920    
921
922    /**
923     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
924     * expression</a> on the supplied header name's contents
925     * 
926     * @param text the expression to be evaluated
927     * @param headerName the name of the header to apply the expression to
928     * @return the builder to continue processing the DSL
929     */
930    public T xpath(String text, String headerName) {
931        return delegate.xpath(text, headerName);
932    }
933
934    /**
935     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
936     * expression</a> with the specified result type
937     * 
938     * @param text the expression to be evaluated
939     * @param resultType the return type expected by the expression
940     * @return the builder to continue processing the DSL
941     */
942    public T xpath(String text, Class<?> resultType) {
943        return delegate.xpath(text, resultType);
944    }
945    
946    /**
947     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
948     * expression</a> with the specified result type on the supplied
949     * header name's contents
950     * 
951     * @param text the expression to be evaluated
952     * @param resultType the return type expected by the expression
953     * @param headerName the name of the header to apply the expression to
954     * @return the builder to continue processing the DSL
955     */
956    public T xpath(String text, Class<?> resultType, String headerName) {
957        return delegate.xpath(text, resultType, headerName);
958    }
959    
960    /**
961     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
962     * expression</a> with the specified result type and set of namespace
963     * prefixes and URIs
964     * 
965     * @param text the expression to be evaluated
966     * @param resultType the return type expected by the expression
967     * @param namespaces the namespace prefix and URIs to use
968     * @return the builder to continue processing the DSL
969     */
970    public T xpath(String text, Class<?> resultType, Namespaces namespaces) {
971        return delegate.xpath(text, resultType, namespaces);
972    }
973
974    /**
975     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
976     * expression</a> with the specified result type and set of namespace
977     * prefixes and URIs on the supplied header name's contents
978     * 
979     * @param text the expression to be evaluated
980     * @param resultType the return type expected by the expression
981     * @param headerName the name of the header to apply the expression to
982     * @param namespaces the namespace prefix and URIs to use
983     * 
984     * @return the builder to continue processing the DSL
985     */
986    public T xpath(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
987        return delegate.xpath(text, resultType, namespaces, headerName);
988    }
989    
990    /**
991     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
992     * expression</a> with the specified result type and set of namespace
993     * prefixes and URIs
994     * 
995     * @param text the expression to be evaluated
996     * @param resultType the return type expected by the expression
997     * @param namespaces the namespace prefix and URIs to use
998     * @return the builder to continue processing the DSL
999     */
1000    public T xpath(String text, Class<?> resultType, Map<String, String> namespaces) {
1001        return delegate.xpath(text, resultType, namespaces);
1002    }
1003
1004    /**
1005     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1006     * expression</a> with the specified set of namespace prefixes and URIs
1007     * 
1008     * @param text the expression to be evaluated
1009     * @param namespaces the namespace prefix and URIs to use
1010     * @return the builder to continue processing the DSL
1011     */
1012    public T xpath(String text, Namespaces namespaces) {
1013        return delegate.xpath(text, namespaces);
1014    }
1015
1016    /**
1017     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1018     * expression</a> with the specified set of namespace prefixes and URIs
1019     * 
1020     * @param text the expression to be evaluated
1021     * @param namespaces the namespace prefix and URIs to use
1022     * @return the builder to continue processing the DSL
1023     */
1024    public T xpath(String text, Map<String, String> namespaces) {
1025        return delegate.xpath(text, namespaces);
1026    }
1027
1028    /**
1029     * Evaluates an <a
1030     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1031     * 
1032     * @param text the expression to be evaluated
1033     * @return the builder to continue processing the DSL
1034     */
1035    public T xquery(String text) {
1036        return delegate.xquery(text);
1037    }
1038    
1039    /**
1040     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
1041     * expression</a> on the supplied header name's contents
1042     * 
1043     * @param text the expression to be evaluated
1044     * @param headerName the name of the header to apply the expression to
1045     * @return the builder to continue processing the DSL
1046     */
1047    public T xquery(String text, String headerName) {
1048        return delegate.xquery(text, headerName);
1049    }
1050
1051
1052    /**
1053     * Evaluates an <a
1054     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1055     * with the specified result type
1056     * 
1057     * @param text the expression to be evaluated
1058     * @param resultType the return type expected by the expression
1059     * @return the builder to continue processing the DSL
1060     */
1061    public T xquery(String text, Class<?> resultType) {
1062        return delegate.xquery(text, resultType);
1063    }
1064    
1065    /**
1066     * Evaluates an <a
1067     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1068     * with the specified result type
1069     * 
1070     * @param text the expression to be evaluated
1071     * @param resultType the return type expected by the expression
1072     * @param headerName the name of the header to apply the expression to
1073     * @return the builder to continue processing the DSL
1074     */
1075    public T xquery(String text, Class<?> resultType, String headerName) {
1076        return delegate.xquery(text, resultType, headerName);
1077    }
1078    
1079    /**
1080     * Evaluates an <a
1081     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1082     * with the specified result type and set of namespace prefixes and URIs
1083     * 
1084     * @param text the expression to be evaluated
1085     * @param resultType the return type expected by the expression
1086     * @param namespaces the namespace prefix and URIs to use
1087     * @return the builder to continue processing the DSL
1088     */
1089    public T xquery(String text, Class<?> resultType, Namespaces namespaces) {
1090        return delegate.xquery(text, resultType, namespaces);
1091    }
1092    
1093    /**
1094     * Evaluates an <a
1095     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1096     * with the specified result type
1097     * 
1098     * @param text the expression to be evaluated
1099     * @param resultType the return type expected by the expression
1100     * @param headerName the name of the header to apply the expression to
1101     * @param namespaces the namespace prefix and URIs to use
1102     * 
1103     * @return the builder to continue processing the DSL
1104     */
1105    public T xquery(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
1106        return delegate.xquery(text, resultType, namespaces, headerName);
1107    }
1108    /**
1109     * Evaluates an <a
1110     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1111     * with the specified result type and set of namespace prefixes and URIs
1112     * 
1113     * @param text the expression to be evaluated
1114     * @param resultType the return type expected by the expression
1115     * @param namespaces the namespace prefix and URIs to use
1116     * @return the builder to continue processing the DSL
1117     */
1118    public T xquery(String text, Class<?> resultType, Map<String, String> namespaces) {
1119        return delegate.xquery(text, resultType, namespaces);
1120    }
1121
1122    /**
1123     * Evaluates an <a
1124     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1125     * with the specified set of namespace prefixes and URIs
1126     * 
1127     * @param text the expression to be evaluated
1128     * @param namespaces the namespace prefix and URIs to use
1129     * @return the builder to continue processing the DSL
1130     */
1131    public T xquery(String text, Namespaces namespaces) {
1132        return delegate.xquery(text, namespaces);
1133    }
1134
1135    /**
1136     * Evaluates an <a
1137     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1138     * with the specified set of namespace prefixes and URIs
1139     * 
1140     * @param text the expression to be evaluated
1141     * @param namespaces the namespace prefix and URIs to use
1142     * @return the builder to continue processing the DSL
1143     */
1144    public T xquery(String text, Map<String, String> namespaces) {
1145        return delegate.xquery(text, namespaces);
1146    }
1147
1148    /**
1149     * Evaluates a given language name with the expression text
1150     * 
1151     * @param language the name of the language
1152     * @param expression the expression in the given language
1153     * @return the builder to continue processing the DSL
1154     */
1155    public T language(String language, String expression) {
1156        return delegate.language(language, expression);
1157    }
1158
1159    // Properties
1160    // -------------------------------------------------------------------------
1161
1162    @Override
1163    public Expression getExpressionValue() {
1164        return delegate.getExpressionValue();
1165    }
1166
1167    @Override
1168    protected void setExpressionValue(Expression expressionValue) {
1169        delegate.setExpressionValue(expressionValue);
1170    }
1171
1172    @Override
1173    public ExpressionDefinition getExpressionType() {
1174        return delegate.getExpressionType();
1175    }
1176
1177    @Override
1178    protected void setExpressionType(ExpressionDefinition expressionType) {
1179        delegate.setExpressionType(expressionType);
1180    }
1181}