From: David ‘Bombe’ Roden Date: Sat, 11 Jul 2015 02:25:23 +0000 (+0200) Subject: Allow setting the Identifier field in the ListPeer message X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=37e46fc5c94a4fb3f074f99fa89630ab9cb619ab;p=jFCPlib.git Allow setting the Identifier field in the ListPeer message --- diff --git a/src/main/java/net/pterodactylus/fcp/ListPeer.java b/src/main/java/net/pterodactylus/fcp/ListPeer.java index e96a389..0ce2a04 100644 --- a/src/main/java/net/pterodactylus/fcp/ListPeer.java +++ b/src/main/java/net/pterodactylus/fcp/ListPeer.java @@ -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); }