Refactor Renderer DeviceRenderingResult class 83/97083/1
authorguillaume.lambert <guillaume.lambert@orange.com>
Thu, 5 Aug 2021 13:43:53 +0000 (15:43 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Thu, 5 Aug 2021 13:43:53 +0000 (15:43 +0200)
JIRA: TRNSPRTPCE-491
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: I80720d752c072b1f821053716a2ae48692dca087

renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRenderingResult.java

index 2bc1b0d19c58e93b7bdfc443990bffcf304ab485..121790a31dbd2612081b9eabe3cb6739ccfdef1e 100644 (file)
@@ -23,21 +23,18 @@ public final class DeviceRenderingResult extends OperationResult {
     private DeviceRenderingResult(boolean success, String message, List<Nodes> olmList,
             List<NodeInterface> renderedNodeInterfaces, List<LinkTp> 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<Nodes> getOlmList() {
@@ -57,7 +54,7 @@ public final class DeviceRenderingResult extends OperationResult {
     }
 
     public static DeviceRenderingResult ok(List<Nodes> olmNodeList, List<NodeInterface> renderedNodeInterfaces,
-        List<LinkTp> otnLinkTps) {
+            List<LinkTp> otnLinkTps) {
         return new DeviceRenderingResult(true, "", olmNodeList, renderedNodeInterfaces, otnLinkTps);
     }