Author: bombe
Date: 2008-04-15 17:53:31 +0000 (Tue, 15 Apr 2008)
New Revision: 19353

Modified:
   trunk/apps/jFCPlib/src/net/pterodactylus/fcp/Peer.java
Log:
 r19 at natrium:  bombe | 2008-04-15 19:52:06 +0200
 add getter for metadata and volatile fields


Modified: trunk/apps/jFCPlib/src/net/pterodactylus/fcp/Peer.java
===================================================================
--- trunk/apps/jFCPlib/src/net/pterodactylus/fcp/Peer.java      2008-04-15 
17:51:02 UTC (rev 19352)
+++ trunk/apps/jFCPlib/src/net/pterodactylus/fcp/Peer.java      2008-04-15 
17:53:31 UTC (rev 19353)
@@ -183,4 +183,33 @@
                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);
+       }
+
 }


Reply via email to