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