Make methods static 80/92680/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Sep 2020 22:43:15 +0000 (00:43 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 24 Sep 2020 22:43:15 +0000 (00:43 +0200)
Eclipse is pointing out a number of methods which can be made static,
fix those warnings.

Change-Id: I4691094f1e5ee098cca5d377a92a3417d667de7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/alarm/AlarmAgent.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/GetAllNodesCommandProvider.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/GetFlowGroupCacheProvider.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/GetReconciliationStateProvider.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/Reconciliation.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ReconciliationCount.java
applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java

index 18de879bac2b78ed6fc1b91f89b4e27bb5872509..5f20a88ce81594dc3ca373f7d064c8b8b3ce1b0a 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.southboundcli.alarm;
 
 import java.lang.management.ManagementFactory;
@@ -127,7 +126,7 @@ public class AlarmAgent {
      * @param nodeId Source of the alarm nodeId
      * @param event reason for alarm invoke/clear
      */
-    private String getAlarmText(final Long nodeId, final String event) {
+    private static String getAlarmText(final Long nodeId, final String event) {
         return new StringBuilder("OF Switch ").append(nodeId).append(event).toString();
     }
 
@@ -136,7 +135,7 @@ public class AlarmAgent {
      *
      * @param nodeId Source of the alarm nodeId
      */
-    private String getSourceText(final Long nodeId) {
+    private static String getSourceText(final Long nodeId) {
         return "Dpn=" + nodeId;
     }
 }
index 196887453cf76d247419f25726ddfced23885ceb..135e8498ae54d45f8c881012e48fc27b51e95556 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.southboundcli.cli;
 
 import java.util.Formatter;
@@ -56,7 +55,7 @@ public class GetAllNodesCommandProvider extends OsgiCommandSupport {
         return null;
     }
 
-    private String getAllLocalNodesHeaderOutput() {
+    private static String getAllLocalNodesHeaderOutput() {
         Formatter formatter = new Formatter();
         String header = formatter.format("%-15s %3s %-15s", "NodeId", "", "NodeName").toString();
         formatter.close();
index 94d6c56e2422aca843b2c7e0cd2fccedf95bf986..fbc8d7f0e9e577b9f04542e1019b493a6ad81870 100644 (file)
@@ -26,7 +26,7 @@ public class GetFlowGroupCacheProvider extends OsgiCommandSupport {
     @Option(name = "-d", description = "Node Id")
     String dpnId;
 
-    private FlowGroupCacheManager flowGroupCacheManager;
+    private final FlowGroupCacheManager flowGroupCacheManager;
 
     public GetFlowGroupCacheProvider(final FlowGroupCacheManager flowGroupCacheManager) {
         this.flowGroupCacheManager = flowGroupCacheManager;
@@ -93,7 +93,7 @@ public class GetFlowGroupCacheProvider extends OsgiCommandSupport {
         return null;
     }
 
-    private String getLocalNodeHeaderOutput() {
+    private static String getLocalNodeHeaderOutput() {
         Formatter formatter = new Formatter();
         String header = formatter.format("%-10s %1s %-8s %1s %-23s %1s %-60s",
                 "TableId", "", "Status", "", "Time", "", "Flow/Group Id").toString();
@@ -101,7 +101,7 @@ public class GetFlowGroupCacheProvider extends OsgiCommandSupport {
         return header;
     }
 
-    private String getAllLocalNodesHeaderOutput() {
+    private static String getAllLocalNodesHeaderOutput() {
         Formatter formatter = new Formatter();
         String header = formatter.format("%-15s %1s %-10s %1s %-8s %1s %-23s %1s %-60s",
                 "DpnId", "", "TableId", "", "Status", "", "Time", "", "Flow/Group Id").toString();
@@ -109,7 +109,7 @@ public class GetFlowGroupCacheProvider extends OsgiCommandSupport {
         return header;
     }
 
-    private String getLineSeparator() {
+    private static String getLineSeparator() {
         return "---------------------------------------------------------------------------------------------"
                 + "-----------------------------------------------";
     }
index 2a6b17cdaa4aae2728666717c4554023112337f5..587f7d9666a4ce567d845b8834b864bb9d11e880 100644 (file)
@@ -55,8 +55,8 @@ public class GetReconciliationStateProvider extends OsgiCommandSupport {
             = "org.opendaylight.openflowplugin.frm:type=ReconciliationState";
     private static final String JMX_ATTRIBUTE_NAME = "acquireReconciliationStates";
     private static final String JMX_REST_HTTP_AUTH_UNAME_PWD = "admin:admin";
-    private ReconciliationJMXServiceMBean reconciliationJMXServiceMBean;
-    private ClusterMemberInfo clusterMemberInfoProvider;
+    private final ReconciliationJMXServiceMBean reconciliationJMXServiceMBean;
+    private final ClusterMemberInfo clusterMemberInfoProvider;
 
 
     public GetReconciliationStateProvider(final ReconciliationJMXServiceMBean reconciliationJMXServiceMBean,
@@ -111,13 +111,13 @@ public class GetReconciliationStateProvider extends OsgiCommandSupport {
         result.stream().forEach(p -> session.getConsole().println(p));
     }
 
-    private String getHeaderOutput() {
+    private static String getHeaderOutput() {
         String header = String.format("%-17s %-25s %-25s", "DatapathId", "Reconciliation Status",
                 "Reconciliation Time");
         return header;
     }
 
-    private String getLineSeparator() {
+    private static String getLineSeparator() {
         return "-------------------------------------------------------------------";
     }
 
@@ -129,7 +129,7 @@ public class GetReconciliationStateProvider extends OsgiCommandSupport {
         LOG.debug("The ip address of nodes in the cluster : {}", clusterIPAddresses);
         if (!clusterIPAddresses.isEmpty()) {
             String selfAddress = clusterMemberInfoProvider.getSelfAddress() != null
-                    ? clusterMemberInfoProvider.getSelfAddress().getHostAddress() : ("localhost");
+                    ? clusterMemberInfoProvider.getSelfAddress().getHostAddress() : "localhost";
             LOG.trace("The ip address of local node is {}", selfAddress);
             for (String memberAddress : clusterIPAddresses) {
                 try {
index b1dee8a8df33188380a2730e18ee52210f5666a3..0239a46cedcff338bd79c0de9bf301f7ed15c3ee 100644 (file)
@@ -68,7 +68,7 @@ public class Reconciliation extends OsgiCommandSupport {
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
-    private void printInProgressNodes(ReconcileOutput reconcileOutput) {
+    private static void printInProgressNodes(ReconcileOutput reconcileOutput) {
         List<Uint64> inprogressNodes = reconcileOutput.getInprogressNodes();
         if (inprogressNodes.size() > 0) {
             StringBuilder stringBuilder = new StringBuilder();
@@ -82,7 +82,7 @@ public class Reconciliation extends OsgiCommandSupport {
         }
     }
 
-    private String getReconcileHeaderOutput() {
+    private static String getReconcileHeaderOutput() {
         final Formatter formatter = new Formatter();
         String header = formatter.format("%-15s %n", "Reconciliation already InProgress for below node(s)").toString();
         formatter.close();
index 8290d799699d308a744948c41910686e34f0b3cd..16c9b953299fda788c919602183c938dc18a9aae 100644 (file)
@@ -49,7 +49,7 @@ public class ReconciliationCount extends OsgiCommandSupport {
         return null;
     }
 
-    private String getReconcileCountHeaderOutput() {
+    private static String getReconcileCountHeaderOutput() {
         final Formatter formatter = new Formatter();
         String header = formatter.format("%-15s %3s %-15s %3s %-15s %3s %-15s %n", "NodeId", "",
                 "ReconcileSuccessCount", "", "ReconcileFailureCount", "", "LastReconcileTime").toString();
index 77825dd7b503c8f83dd54e71b4f1c0eb4e379c15..da4bb99b0ae81180735c2d35bd035283794efcfc 100644 (file)
@@ -50,7 +50,7 @@ public class ShowNodeCommandProvider extends OsgiCommandSupport {
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
-    private void printNodeHeaderOutput() {
+    private static void printNodeHeaderOutput() {
         Formatter formatter = new Formatter();
         String header = formatter.format(OUTPUT_FORMAT, "NodeId", "Name", "Ports").toString();
         formatter.close();
@@ -58,12 +58,12 @@ public class ShowNodeCommandProvider extends OsgiCommandSupport {
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
-    private void printHeaderSeparator() {
+    private static void printHeaderSeparator() {
         System.out.println(HEADER_SEPARATOR);
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
-    private void printNodeOutput(final OFNode ofNode) {
+    private static void printNodeOutput(final OFNode ofNode) {
         String ofNodeId = ofNode.getNodeId().toString();
         String ofNodeName = ofNode.getNodeName();
         System.out.print(new Formatter().format(NEW_LINE, ofNodeId, ofNodeName, ofNode.getPorts()).toString());