add ListPeerNote command and replies
[jSite2.git] / src / net / pterodactylus / util / fcp / message / BaseMessage.java
1 /**
2  * © 2008 INA Service GmbH
3  */
4 package net.pterodactylus.util.fcp.message;
5
6 import net.pterodactylus.util.fcp.FcpMessage;
7
8 /**
9  * A basic message abstraction that wraps a received FCP message.
10  * 
11  * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
12  * @version $Id$
13  */
14 public class BaseMessage {
15
16         /** The received message, wrapped here. */
17         private final FcpMessage receivedMessage;
18
19         /**
20          * Creates a new base message that wraps the given message.
21          * 
22          * @param receivedMessage
23          *            The FCP message that was received
24          */
25         public BaseMessage(FcpMessage receivedMessage) {
26                 this.receivedMessage = receivedMessage;
27         }
28
29         /**
30          * Returns the name of the message.
31          * 
32          * @return The name of the message
33          */
34         public String getName() {
35                 return receivedMessage.getName();
36         }
37
38         /**
39          * Returns the content of the field.
40          * 
41          * @param field
42          *            The name of the field
43          * @return The content of the field, or <code>null</code> if there is no
44          *         such field
45          */
46         public String getField(String field) {
47                 return receivedMessage.getField(field);
48         }
49
50 }