Allow setting the Identifier field in the ListPeer message
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 11 Jul 2015 02:25:23 +0000 (04:25 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 11 Jul 2015 02:25:23 +0000 (04:25 +0200)
src/main/java/net/pterodactylus/fcp/ListPeer.java

index e96a389..0ce2a04 100644 (file)
@@ -18,6 +18,8 @@
 
 package net.pterodactylus.fcp;
 
+import java.util.Optional;
+
 /**
  * The “ListPeer” request asks the node about the details of a given peer.
  *
@@ -35,7 +37,12 @@ public class ListPeer extends FcpMessage {
         *            The identifier of the node to get details about
         */
        public ListPeer(String nodeIdentifier) {
+               this(null, nodeIdentifier);
+       }
+
+       public ListPeer(String identifier, String nodeIdentifier) {
                super("ListPeer");
+               Optional.ofNullable(identifier).ifPresent(id -> setField("Identifier", id));
                setField("NodeIdentifier", nodeIdentifier);
        }