From 37e46fc5c94a4fb3f074f99fa89630ab9cb619ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 11 Jul 2015 04:25:23 +0200 Subject: [PATCH] Allow setting the Identifier field in the ListPeer message --- src/main/java/net/pterodactylus/fcp/ListPeer.java | 7 +++++++ 1 file changed, 7 insertions(+) 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); } -- 2.7.4