Coverage Report - org.apache.camel.builder.Builder
 
Classes in this File Line Coverage Branch Coverage Complexity
Builder
53% 
N/A 
0
 
 1  
 /**
 2  
  *
 3  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 4  
  * contributor license agreements.  See the NOTICE file distributed with
 5  
  * this work for additional information regarding copyright ownership.
 6  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 7  
  * (the "License"); you may not use this file except in compliance with
 8  
  * the License.  You may obtain a copy of the License at
 9  
  *
 10  
  * http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.camel.builder;
 19  
 
 20  
 import org.apache.camel.Exchange;
 21  
 import org.apache.camel.Expression;
 22  
 
 23  
 /**
 24  
  * A helper class for including portions of the
 25  
  * <a href="http://activemq.apache.org/camel/expression.html">expression</a> and
 26  
  * <a href="http://activemq.apache.org/camel/predicate.html">predicate</a>
 27  
  * <a href="http://activemq.apache.org/camel/dsl.html">Java DSL</a>
 28  
  *
 29  
  * @version $Revision: 1.1 $
 30  
  */
 31  0
 public class Builder {
 32  
 
 33  
     /**
 34  
      * Returns a constant expression
 35  
      */
 36  
     public static <E extends Exchange> ValueBuilder<E> constant(Object value) {
 37  3
         Expression<E> expression = ExpressionBuilder.constantExpression(value);
 38  3
         return new ValueBuilder<E>(expression);
 39  
     }
 40  
 
 41  
     /**
 42  
      * Returns a predicate and value builder for headers on an exchange
 43  
      */
 44  
     public static <E extends Exchange> ValueBuilder<E> header(@FluentArg("name") String name) {
 45  25
         Expression<E> expression = ExpressionBuilder.headerExpression(name);
 46  25
         return new ValueBuilder<E>(expression);
 47  
     }
 48  
 
 49  
     /**
 50  
      * Returns a predicate and value builder for the inbound body on an exchange
 51  
      */
 52  
     public static <E extends Exchange> ValueBuilder<E> body() {
 53  4
         Expression<E> expression = ExpressionBuilder.bodyExpression();
 54  4
         return new ValueBuilder<E>(expression);
 55  
     }
 56  
 
 57  
     /**
 58  
      * Returns a predicate and value builder for the inbound message body as a specific type
 59  
      */
 60  
     public static <E extends Exchange, T> ValueBuilder<E> bodyAs( Class<T> type) {
 61  1
         Expression<E> expression = ExpressionBuilder.<E, T>bodyExpression(type);
 62  1
         return new ValueBuilder<E>(expression);
 63  
     }
 64  
 
 65  
     /**
 66  
      * Returns a predicate and value builder for the outbound body on an exchange
 67  
      */
 68  
     public static <E extends Exchange> ValueBuilder<E> outBody() {
 69  0
         Expression<E> expression = ExpressionBuilder.bodyExpression();
 70  0
         return new ValueBuilder<E>(expression);
 71  
     }
 72  
 
 73  
     /**
 74  
      * Returns a predicate and value builder for the outbound message body as a specific type
 75  
      */
 76  
     public static <E extends Exchange, T> ValueBuilder<E> outBody(Class<T> type) {
 77  0
         Expression<E> expression = ExpressionBuilder.<E, T>bodyExpression(type);
 78  0
         return new ValueBuilder<E>(expression);
 79  
     }
 80  
 
 81  
 
 82  
     /**
 83  
      * Returns an expression for the given system property
 84  
      */
 85  
     public static <E extends Exchange> ValueBuilder<E> systemProperty(final String name) {
 86  0
         return systemProperty(name, null);
 87  
     }
 88  
 
 89  
     /**
 90  
      * Returns an expression for the given system property
 91  
      */
 92  
     public static <E extends Exchange> ValueBuilder<E> systemProperty(final String name, final String defaultValue) {
 93  0
         return new ValueBuilder<E>(ExpressionBuilder.<E>systemProperty(name, defaultValue));
 94  
     }
 95  
 }