package net.pterodactylus.fcp;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
/**
* The “Peer” reply by the node contains information about a peer.
*
}
/**
+ * Returns all volatile fields from the message.
+ *
+ * @return All volatile files
+ */
+ public Map<String, String> getVolatileFields() {
+ Map<String, String> volatileFields = new HashMap<String, String>();
+ for (Entry<String, String> field : getFields().entrySet()) {
+ if (field.getKey().startsWith("volatile.")) {
+ volatileFields.put(field.getKey(), field.getValue());
+ }
+ }
+ return Collections.unmodifiableMap(volatileFields);
+ }
+
+ /**
* 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”.
}
/**
+ * Returns all metadata fields from the message.
+ *
+ * @return All volatile files
+ */
+ public Map<String, String> getMetadataFields() {
+ Map<String, String> metadataFields = new HashMap<String, String>();
+ for (Entry<String, String> field : getFields().entrySet()) {
+ if (field.getKey().startsWith("metadata.")) {
+ metadataFields.put(field.getKey(), field.getValue());
+ }
+ }
+ return Collections.unmodifiableMap(metadataFields);
+ }
+
+ /**
* 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