From bc148fbcd6b62f1eb2487336e6a44ddbe8c07d9e Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Thu, 5 Aug 2021 15:43:53 +0200 Subject: [PATCH] Refactor Renderer DeviceRenderingResult class JIRA: TRNSPRTPCE-491 Signed-off-by: guillaume.lambert Change-Id: I80720d752c072b1f821053716a2ae48692dca087 --- .../DeviceRenderingResult.java | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRenderingResult.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRenderingResult.java index 2bc1b0d19..121790a31 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRenderingResult.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRenderingResult.java @@ -23,21 +23,18 @@ public final class DeviceRenderingResult extends OperationResult { private DeviceRenderingResult(boolean success, String message, List olmList, List renderedNodeInterfaces, List otnLinkTps) { super(success, message); - if (olmList != null) { - this.olmList = Collections.unmodifiableList(olmList); - } else { - this.olmList = Collections.emptyList(); - } - if (renderedNodeInterfaces != null) { - this.renderedNodeInterfaces = Collections.unmodifiableList(renderedNodeInterfaces); - } else { - this.renderedNodeInterfaces = Collections.emptyList(); - } - if (otnLinkTps != null) { - this.otnLinkTps = Collections.unmodifiableList(otnLinkTps); - } else { - this.otnLinkTps = Collections.emptyList(); - } + this.olmList = + olmList == null + ? Collections.emptyList() + : Collections.unmodifiableList(olmList); + this.renderedNodeInterfaces = + renderedNodeInterfaces == null + ? Collections.emptyList() + : Collections.unmodifiableList(renderedNodeInterfaces); + this.otnLinkTps = + otnLinkTps == null + ? Collections.emptyList() + : Collections.unmodifiableList(otnLinkTps); } public List getOlmList() { @@ -57,7 +54,7 @@ public final class DeviceRenderingResult extends OperationResult { } public static DeviceRenderingResult ok(List olmNodeList, List renderedNodeInterfaces, - List otnLinkTps) { + List otnLinkTps) { return new DeviceRenderingResult(true, "", olmNodeList, renderedNodeInterfaces, otnLinkTps); } -- 2.36.6