add getter for metadata and volatile fields
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Tue, 15 Apr 2008 17:52:06 +0000 (17:52 +0000)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Tue, 15 Apr 2008 17:52:06 +0000 (17:52 +0000)
git-svn-id: http://trooper/svn/projects/jFCPlib/branch/high-level-client@826 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/fcp/Peer.java

index 4a21f5c..f7d3378 100644 (file)
@@ -183,4 +183,33 @@ public class Peer extends BaseMessage {
                return FcpUtils.decodeMultiIntegerField(getField("auth.negTypes"));
        }
 
+       /**
+        * Returns one of the volatile fields from the message. The given field name
+        * is prepended with “volatile.” so if you want to get the value of the
+        * field with the name “volatile.status” you only need to specify “status”.
+        * 
+        * @param field
+        *            The name of the field
+        * @return The value of the field, or <code>null</code> if there is no
+        *         such field
+        */
+       public String getVolatile(String field) {
+               return getField("volatile." + field);
+       }
+
+       /**
+        * Returns one of the metadata fields from the message. The given field name
+        * is prepended with “metadata.” so if you want to get the value of the
+        * field with the name “metadata.timeLastRoutable” you only need to specify
+        * “timeLastRoutable”.
+        * 
+        * @param field
+        *            The name of the field
+        * @return The value of the field, or <code>null</code> if there is no
+        *         such field
+        */
+       public String getMetadata(String field) {
+               return getField("metadata." + field);
+       }
+
 }