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