Coverage Report - org.apache.camel.Message
 
Classes in this File Line Coverage Branch Coverage Complexity
Message
N/A 
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;
 19  
 
 20  
 import java.util.Map;
 21  
 
 22  
 /**
 23  
  * Implements the <a href="http://activemq.apache.org/camel/message.html">Message</a>
 24  
  * pattern and represents an inbound or outbound message as part of an {@link Exchange}
 25  
  * 
 26  
  * @version $Revision: 540152 $
 27  
  */
 28  
 public interface Message {
 29  
     
 30  
     /**
 31  
      * @return the id of the message
 32  
      */
 33  
     String getMessageId();
 34  
     
 35  
     /**
 36  
      * set the id of the message
 37  
      * @param messageId
 38  
      */
 39  
     void setMessageId(String messageId);
 40  
 
 41  
     /**
 42  
      * Returns the exchange this message is related to
 43  
      * 
 44  
      * @return
 45  
      */
 46  
     Exchange getExchange();
 47  
     
 48  
     /**
 49  
      * Accesses a specific header
 50  
      *
 51  
      * @param name
 52  
      * @return object header associated with the name
 53  
      */
 54  
     Object getHeader(String name);
 55  
 
 56  
     /**
 57  
      * Returns a header associated with this message by name and specifying the type required
 58  
      *
 59  
      * @param name the name of the header
 60  
      * @param type the type of the header
 61  
      * @return the value of the given header or null if there is no property for the given name or it cannot be
 62  
      * converted to the given type
 63  
      */
 64  
     <T> T getHeader(String name, Class<T> type);
 65  
 
 66  
     /**
 67  
      * Sets a header on the message
 68  
      *
 69  
      * @param name  of the header
 70  
      * @param value to associate with the name
 71  
      */
 72  
     void setHeader(String name, Object value);
 73  
 
 74  
     /**
 75  
      * Returns all of the headers associated with the message
 76  
      *
 77  
      * @return all the headers in a Map
 78  
      */
 79  
     Map<String, Object> getHeaders();
 80  
     
 81  
     /**
 82  
      * Set all the headers associated with this message
 83  
      * @param headers
 84  
      */
 85  
     void setHeaders(Map<String,Object> headers);
 86  
 
 87  
     /**
 88  
      * Returns the body of the message as a POJO
 89  
      *
 90  
      * @return the body of the message
 91  
      */
 92  
     public Object getBody();
 93  
 
 94  
     /**
 95  
      * Returns the body as the specified type
 96  
      *
 97  
      * @param type the type that the body
 98  
      * @return the body of the message as the specified type
 99  
      */
 100  
     public <T> T getBody(Class<T> type);
 101  
 
 102  
     /**
 103  
      * Sets the body of the message
 104  
      */
 105  
     public void setBody(Object body);
 106  
 
 107  
     /**
 108  
      * Sets the body of the message as a specific type
 109  
      */
 110  
     public <T> void setBody(Object body, Class<T> type);
 111  
 
 112  
     /**
 113  
      * Creates a copy of this message so that it can be used and possibly modified further in another exchange
 114  
      * 
 115  
      * @return a new message instance copied from this message
 116  
      */
 117  
     Message copy();
 118  
 
 119  
 }