From 8836e69bc81ccbb8ac4c50e5ca40e66bd2552af4 Mon Sep 17 00:00:00 2001 From: David Roden Date: Tue, 15 Apr 2008 17:53:31 +0000 Subject: [PATCH] r19@natrium: bombe | 2008-04-15 19:52:06 +0200 add getter for metadata and volatile fields git-svn-id: file:///home/toad/git-migration/temprepository/trunk/apps/jFCPlib@19353 67a373e5-eb02-0410-a15c-ee090a768436 --- src/net/pterodactylus/fcp/Peer.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/net/pterodactylus/fcp/Peer.java b/src/net/pterodactylus/fcp/Peer.java index 4a21f5c..f7d3378 100644 --- a/src/net/pterodactylus/fcp/Peer.java +++ b/src/net/pterodactylus/fcp/Peer.java @@ -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 null 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 null if there is no + * such field + */ + public String getMetadata(String field) { + return getField("metadata." + field); + } + } -- 2.7.4