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 href="http://commons.apache.org/jxpath/">JXPath expression</a>
501     * 
502     * @param text the expression to be evaluated
503     * @return the builder to continue processing the DSL
504     */
505    public T jxpath(String text) {
506        return delegate.jxpath(text);
507    }
508
509    /**
510     * Evaluates a <a href="http://commons.apache.org/jxpath/">JXPath expression</a>
511     *
512     * @param text the expression to be evaluated
513     * @param lenient to configure whether lenient is in use or not
514     * @return the builder to continue processing the DSL
515     */
516    public T jxpath(String text, boolean lenient) {
517        return delegate.jxpath(text, lenient);
518    }
519
520    /**
521     * Evaluates an <a href="http://camel.apache.org/ognl.html">OGNL
522     * expression</a>
523     * 
524     * @param text the expression to be evaluated
525     * @return the builder to continue processing the DSL
526     */
527    public T ognl(String text) {
528        return delegate.ognl(text);
529    }
530
531    /**
532     * Evaluates a <a href="http://camel.apache.org/mvel.html">MVEL
533     * expression</a>
534     *
535     * @param text the expression to be evaluated
536     * @return the builder to continue processing the DSL
537     */
538    public T mvel(String text) {
539        return delegate.mvel(text);
540    }
541
542    /**
543     * Evaluates a <a href="http://camel.apache.org/php.html">PHP
544     * expression</a>
545     * 
546     * @param text the expression to be evaluated
547     * @return the builder to continue processing the DSL
548     */
549    public T php(String text) {
550        return delegate.php(text);
551    }
552
553    /**
554     * Evaluates a <a href="http://camel.apache.org/python.html">Python
555     * expression</a>
556     * 
557     * @param text the expression to be evaluated
558     * @return the builder to continue processing the DSL
559     */
560    public T python(String text) {
561        return delegate.python(text);
562    }
563
564    /**
565     * Evaluates a <a href="http://camel.apache.org/ref-language.html">Ref
566     * expression</a>
567     * 
568     * @param ref refers to the expression to be evaluated
569     * @return the builder to continue processing the DSL
570     */
571    public T ref(String ref) {
572        return delegate.ref(ref);
573    }
574
575    /**
576     * Evaluates a <a href="http://camel.apache.org/ruby.html">Ruby
577     * expression</a>
578     *
579     * @param text the expression to be evaluated
580     * @return the builder to continue processing the DSL
581     */
582    public T ruby(String text) {
583        return delegate.ruby(text);
584    }
585
586    /**
587     * Evaluates an <a href="http://camel.apache.org/sql.html">SQL
588     * expression</a>
589     * 
590     * @param text the expression to be evaluated
591     * @return the builder to continue processing the DSL
592     */
593    public T sql(String text) {
594        return delegate.sql(text);
595    }
596
597    /**
598     * Evaluates a <a href="http://camel.apache.org/spel.html">SpEL
599     * expression</a>
600     * 
601     * @param text the expression to be evaluated
602     * @return the builder to continue processing the DSL
603     */
604    public T spel(String text) {
605        return delegate.spel(text);
606    }
607    
608    /**
609     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
610     * expression</a>
611     * 
612     * @param text the expression to be evaluated
613     * @return the builder to continue processing the DSL
614     */
615    public T simple(String text) {
616        return delegate.simple(text);
617    }
618
619    /**
620     * Evaluates a <a href="http://camel.apache.org/simple.html">Simple
621     * expression</a>
622     *
623     * @param text the expression to be evaluated
624     * @param resultType the result type
625     * @return the builder to continue processing the DSL
626     */
627    public T simple(String text, Class<?> resultType) {
628        return delegate.simple(text, resultType);
629    }
630
631    /**
632     * Evaluates a token expression on the message body
633     *
634     * @param token the token
635     * @return the builder to continue processing the DSL
636     */
637    public T tokenize(String token) {
638        return delegate.tokenize(token);
639    }
640
641    /**
642     * Evaluates a token expression on the message body
643     *
644     * @param token the token
645     * @param regex whether the token is a regular expression or not
646     * @return the builder to continue processing the DSL
647     */
648    public T tokenize(String token, boolean regex) {
649        return tokenize(token, regex, false);
650    }
651
652    /**
653     * Evaluates a token expression on the message body
654     *
655     * @param token the token
656     * @param regex whether the token is a regular expression or not
657     * @param skipFirst whether to skip the first element
658     * @return the builder to continue processing the DSL
659     */
660    public T tokenize(String token, boolean regex, boolean skipFirst) {
661        return delegate.tokenize(token, null, regex, skipFirst);
662    }
663
664    /**
665     * Evaluates a token expression on the message body
666     *
667     * @param token the token
668     * @param regex whether the token is a regular expression or not
669     * @param group to group by the given number
670     * @return the builder to continue processing the DSL
671     */
672    public T tokenize(String token, boolean regex, int group) {
673        return tokenize(token, regex, group, false);
674    }
675
676    /**
677     * Evaluates a token expression on the message body
678     *
679     * @param token the token
680     * @param regex whether the token is a regular expression or not
681     * @param group to group by the given number
682     * @param skipFirst whether to skip the first element
683     * @return the builder to continue processing the DSL
684     */
685    public T tokenize(String token, boolean regex, int group, boolean skipFirst) {
686        return delegate.tokenize(token, null, regex, group, skipFirst);
687    }
688
689    /**
690     * Evaluates a token expression on the message body
691     *
692     * @param token the token
693     * @param group to group by the given number
694     * @return the builder to continue processing the DSL
695     */
696    public T tokenize(String token, int group) {
697        return delegate.tokenize(token, group);
698    }
699
700    /**
701     * Evaluates a token expression on the message body
702     *
703     * @param token the token
704     * @param group to group by the given number
705     * @param skipFirst whether to skip the first element
706     * @return the builder to continue processing the DSL
707     */
708    public T tokenize(String token, int group, boolean skipFirst) {
709        return delegate.tokenize(token, group, skipFirst);
710    }
711
712    /**
713     * Evaluates a token expression on the given header
714     *
715     * @param token the token
716     * @param headerName name of header to tokenize
717     * @return the builder to continue processing the DSL
718     */
719    public T tokenize(String token, String headerName) {
720        return delegate.tokenize(token, headerName);
721    }
722
723    /**
724     * Evaluates a token expression on the given header
725     *
726     * @param token the token
727     * @param headerName name of header to tokenize
728     * @param regex whether the token is a regular expression or not
729     * @return the builder to continue processing the DSL
730     */
731    public T tokenize(String token, String headerName, boolean regex) {
732        return delegate.tokenize(token, headerName, regex);
733    }
734
735    /**
736     * Evaluates a token pair expression on the message body.
737     * <p/>
738     * Tokens is not included.
739     *
740     * @param startToken the start token
741     * @param endToken   the end token
742     * @return the builder to continue processing the DSL
743     */
744    public T tokenizePair(String startToken, String endToken) {
745        return tokenizePair(startToken, endToken, false);
746    }
747
748    /**
749     * Evaluates a token pair expression on the message body
750     *
751     * @param startToken the start token
752     * @param endToken   the end token
753     * @param includeTokens whether to include tokens
754     * @return the builder to continue processing the DSL
755     */
756    public T tokenizePair(String startToken, String endToken, boolean includeTokens) {
757        return delegate.tokenizePair(startToken, endToken, includeTokens);
758    }
759
760    /**
761     * Evaluates a XML token expression on the message body with XML content
762     *
763     * @param tagName the the tag name of the child nodes to tokenize
764     * @return the builder to continue processing the DSL
765     */
766    public T tokenizeXML(String tagName) {
767        return tokenizeXML(tagName, null);
768    }
769
770    /**
771     * Evaluates a XML token expression on the message body with XML content
772     *
773     * @param tagName the the tag name of the child nodes to tokenize
774     * @param group to group by the given number
775     * @return the builder to continue processing the DSL
776     */
777    public T tokenizeXML(String tagName, int group) {
778        return tokenizeXML(tagName, null, group);
779    }
780
781    /**
782     * Evaluates a token pair expression on the message body with XML content
783     *
784     * @param tagName the the tag name of the child nodes to tokenize
785     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
786     * @return the builder to continue processing the DSL
787     */
788    public T tokenizeXML(String tagName, String inheritNamespaceTagName) {
789        return tokenizeXML(tagName, inheritNamespaceTagName, 0);
790    }
791
792    /**
793     * Evaluates a token pair expression on the message body with XML content
794     *
795     * @param tagName the the tag name of the child nodes to tokenize
796     * @param inheritNamespaceTagName  parent or root tag name that contains namespace(s) to inherit
797     * @param group to group by the given number
798     * @return the builder to continue processing the DSL
799     */
800    public T tokenizeXML(String tagName, String inheritNamespaceTagName, int group) {
801        return delegate.tokenizeXMLPair(tagName, inheritNamespaceTagName, group);
802    }
803
804    public T xtokenize(String path, Namespaces namespaces) {
805        return xtokenize(path, 'i', namespaces);
806    }
807
808    public T xtokenize(String path, char mode, Namespaces namespaces) {
809        return xtokenize(path, mode, namespaces, 0);
810    }
811
812    public T xtokenize(String path, char mode, Namespaces namespaces, int group) {
813        return delegate.xtokenize(path, mode, namespaces, group);
814    }
815
816    /**
817     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
818     * expression</a>
819     * 
820     * @param text the expression to be evaluated
821     * @return the builder to continue processing the DSL
822     */
823    public T xpath(String text) {
824        return delegate.xpath(text);
825    }
826    
827
828    /**
829     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
830     * expression</a> on the supplied header name's contents
831     * 
832     * @param text the expression to be evaluated
833     * @param headerName the name of the header to apply the expression to
834     * @return the builder to continue processing the DSL
835     */
836    public T xpath(String text, String headerName) {
837        return delegate.xpath(text, headerName);
838    }
839
840    /**
841     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
842     * expression</a> with the specified result type
843     * 
844     * @param text the expression to be evaluated
845     * @param resultType the return type expected by the expression
846     * @return the builder to continue processing the DSL
847     */
848    public T xpath(String text, Class<?> resultType) {
849        return delegate.xpath(text, resultType);
850    }
851    
852    /**
853     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
854     * expression</a> with the specified result type on the supplied
855     * header name's contents
856     * 
857     * @param text the expression to be evaluated
858     * @param resultType the return type expected by the expression
859     * @param headerName the name of the header to apply the expression to
860     * @return the builder to continue processing the DSL
861     */
862    public T xpath(String text, Class<?> resultType, String headerName) {
863        return delegate.xpath(text, resultType, headerName);
864    }
865    
866    /**
867     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
868     * expression</a> with the specified result type and set of namespace
869     * prefixes and URIs
870     * 
871     * @param text the expression to be evaluated
872     * @param resultType the return type expected by the expression
873     * @param namespaces the namespace prefix and URIs to use
874     * @return the builder to continue processing the DSL
875     */
876    public T xpath(String text, Class<?> resultType, Namespaces namespaces) {
877        return delegate.xpath(text, resultType, namespaces);
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 on the supplied header name's contents
884     * 
885     * @param text the expression to be evaluated
886     * @param resultType the return type expected by the expression
887     * @param headerName the name of the header to apply the expression to
888     * @param namespaces the namespace prefix and URIs to use
889     * 
890     * @return the builder to continue processing the DSL
891     */
892    public T xpath(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
893        return delegate.xpath(text, resultType, namespaces, headerName);
894    }
895    
896    /**
897     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
898     * expression</a> with the specified result type and set of namespace
899     * prefixes and URIs
900     * 
901     * @param text the expression to be evaluated
902     * @param resultType the return type expected by the expression
903     * @param namespaces the namespace prefix and URIs to use
904     * @return the builder to continue processing the DSL
905     */
906    public T xpath(String text, Class<?> resultType, Map<String, String> namespaces) {
907        return delegate.xpath(text, resultType, namespaces);
908    }
909
910    /**
911     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
912     * expression</a> with the specified set of namespace prefixes and URIs
913     * 
914     * @param text the expression to be evaluated
915     * @param namespaces the namespace prefix and URIs to use
916     * @return the builder to continue processing the DSL
917     */
918    public T xpath(String text, Namespaces namespaces) {
919        return delegate.xpath(text, namespaces);
920    }
921
922    /**
923     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
924     * expression</a> with the specified set of namespace prefixes and URIs
925     * 
926     * @param text the expression to be evaluated
927     * @param namespaces the namespace prefix and URIs to use
928     * @return the builder to continue processing the DSL
929     */
930    public T xpath(String text, Map<String, String> namespaces) {
931        return delegate.xpath(text, namespaces);
932    }
933
934    /**
935     * Evaluates an <a
936     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
937     * 
938     * @param text the expression to be evaluated
939     * @return the builder to continue processing the DSL
940     */
941    public T xquery(String text) {
942        return delegate.xquery(text);
943    }
944    
945    /**
946     * Evaluates an <a href="http://camel.apache.org/xpath.html">XPath
947     * expression</a> on the supplied header name's contents
948     * 
949     * @param text the expression to be evaluated
950     * @param headerName the name of the header to apply the expression to
951     * @return the builder to continue processing the DSL
952     */
953    public T xquery(String text, String headerName) {
954        return delegate.xquery(text, headerName);
955    }
956
957
958    /**
959     * Evaluates an <a
960     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
961     * with the specified result type
962     * 
963     * @param text the expression to be evaluated
964     * @param resultType the return type expected by the expression
965     * @return the builder to continue processing the DSL
966     */
967    public T xquery(String text, Class<?> resultType) {
968        return delegate.xquery(text, resultType);
969    }
970    
971    /**
972     * Evaluates an <a
973     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
974     * with the specified result type
975     * 
976     * @param text the expression to be evaluated
977     * @param resultType the return type expected by the expression
978     * @param headerName the name of the header to apply the expression to
979     * @return the builder to continue processing the DSL
980     */
981    public T xquery(String text, Class<?> resultType, String headerName) {
982        return delegate.xquery(text, resultType, headerName);
983    }
984    
985    /**
986     * Evaluates an <a
987     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
988     * with the specified result type and set of namespace prefixes and URIs
989     * 
990     * @param text the expression to be evaluated
991     * @param resultType the return type expected by the expression
992     * @param namespaces the namespace prefix and URIs to use
993     * @return the builder to continue processing the DSL
994     */
995    public T xquery(String text, Class<?> resultType, Namespaces namespaces) {
996        return delegate.xquery(text, resultType, namespaces);
997    }
998    
999    /**
1000     * Evaluates an <a
1001     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1002     * with the specified result type
1003     * 
1004     * @param text the expression to be evaluated
1005     * @param resultType the return type expected by the expression
1006     * @param headerName the name of the header to apply the expression to
1007     * @param namespaces the namespace prefix and URIs to use
1008     * 
1009     * @return the builder to continue processing the DSL
1010     */
1011    public T xquery(String text, Class<?> resultType, Namespaces namespaces, String headerName) {
1012        return delegate.xquery(text, resultType, namespaces, headerName);
1013    }
1014    /**
1015     * Evaluates an <a
1016     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1017     * with the specified result type and set of namespace prefixes and URIs
1018     * 
1019     * @param text the expression to be evaluated
1020     * @param resultType the return type expected by the expression
1021     * @param namespaces the namespace prefix and URIs to use
1022     * @return the builder to continue processing the DSL
1023     */
1024    public T xquery(String text, Class<?> resultType, Map<String, String> namespaces) {
1025        return delegate.xquery(text, resultType, namespaces);
1026    }
1027
1028    /**
1029     * Evaluates an <a
1030     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1031     * with the specified set of namespace prefixes and URIs
1032     * 
1033     * @param text the expression to be evaluated
1034     * @param namespaces the namespace prefix and URIs to use
1035     * @return the builder to continue processing the DSL
1036     */
1037    public T xquery(String text, Namespaces namespaces) {
1038        return delegate.xquery(text, namespaces);
1039    }
1040
1041    /**
1042     * Evaluates an <a
1043     * href="http://camel.apache.org/xquery.html">XQuery expression</a>
1044     * with the specified set of namespace prefixes and URIs
1045     * 
1046     * @param text the expression to be evaluated
1047     * @param namespaces the namespace prefix and URIs to use
1048     * @return the builder to continue processing the DSL
1049     */
1050    public T xquery(String text, Map<String, String> namespaces) {
1051        return delegate.xquery(text, namespaces);
1052    }
1053
1054    /**
1055     * Evaluates a given language name with the expression text
1056     * 
1057     * @param language the name of the language
1058     * @param expression the expression in the given language
1059     * @return the builder to continue processing the DSL
1060     */
1061    public T language(String language, String expression) {
1062        return delegate.language(language, expression);
1063    }
1064
1065    // Properties
1066    // -------------------------------------------------------------------------
1067
1068    @Override
1069    public Expression getExpressionValue() {
1070        return delegate.getExpressionValue();
1071    }
1072
1073    @Override
1074    protected void setExpressionValue(Expression expressionValue) {
1075        delegate.setExpressionValue(expressionValue);
1076    }
1077
1078    @Override
1079    public ExpressionDefinition getExpressionType() {
1080        return delegate.getExpressionType();
1081    }
1082
1083    @Override
1084    protected void setExpressionType(ExpressionDefinition expressionType) {
1085        delegate.setExpressionType(expressionType);
1086    }
1087}