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