Bug 8153: Enforce check-style rules for netconf - netconf-mapping-api 94/55794/1
authormatus.kubica <matus.kubica@pantheon.tech>
Fri, 21 Apr 2017 09:08:12 +0000 (11:08 +0200)
committermatus.kubica <matus.kubica@pantheon.tech>
Fri, 21 Apr 2017 09:08:12 +0000 (11:08 +0200)
    Organize Imports for Checkstyle compliance.
    Checkstyle compliance: line length.
    Checkstyle compliance: various types of small changes.
    Checkstyle compliant Exception handling.
    Checkstyle final clean up & enforcement.

Change-Id: I733c6883a59a27b680c8e35b43f42f649a06906a
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
netconf/netconf-mapping-api/src/main/java/org/opendaylight/netconf/mapping/api/HandlingPriority.java
netconf/netconf-mapping-api/src/main/java/org/opendaylight/netconf/mapping/api/NetconfOperation.java
netconf/netconf-mapping-api/src/main/java/org/opendaylight/netconf/mapping/api/NetconfOperationChainedExecution.java
netconf/netconf-mapping-api/src/main/java/org/opendaylight/netconf/mapping/api/NetconfOperationService.java
netconf/netconf-mapping-api/src/main/java/org/opendaylight/netconf/mapping/api/NetconfOperationServiceFactory.java

index 98220d19e0abf1fa1373429b14580d77ccd87c02..078e9aae9ed71eef43c70dbb30b9c195f6744013 100644 (file)
@@ -32,6 +32,8 @@ public final class HandlingPriority implements Comparable<HandlingPriority> {
     }
 
     /**
+     * Get priority number.
+     *
      * @return priority number or Optional.absent otherwise
      */
     public Optional<Integer> getPriority() {
@@ -39,7 +41,7 @@ public final class HandlingPriority implements Comparable<HandlingPriority> {
     }
 
     public HandlingPriority increasePriority(int priorityIncrease) {
-        Preconditions.checkState(priority!=null, "Unable to increase priority for %s", this);
+        Preconditions.checkState(priority != null, "Unable to increase priority for %s", this);
         Preconditions.checkArgument(priorityIncrease > 0, "Negative increase");
         Preconditions.checkArgument(Long.valueOf(priority) + priorityIncrease < Integer.MAX_VALUE,
                 "Resulting priority cannot be higher than %s", Integer.MAX_VALUE);
@@ -51,42 +53,42 @@ public final class HandlingPriority implements Comparable<HandlingPriority> {
     }
 
     @Override
-    public int compareTo(HandlingPriority o) {
-        if (this == o) {
+    public int compareTo(HandlingPriority priority) {
+        if (this == priority) {
             return 0;
         }
         if (isCannotHandle()) {
             return -1;
         }
-        if (o.isCannotHandle()) {
+        if (priority.isCannotHandle()) {
             return 1;
         }
 
-        if (priority > o.priority){
+        if (this.priority > priority.priority) {
             return 1;
         }
-        if (priority.equals(o.priority)){
+        if (this.priority.equals(priority.priority)) {
             return 0;
         }
-        if (priority < o.priority){
+        if (this.priority < priority.priority) {
             return -1;
         }
 
-        throw new IllegalStateException("Unexpected state comparing " + this + " with " + o);
+        throw new IllegalStateException("Unexpected state comparing " + this + " with " + priority);
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o){
+    public boolean equals(Object obj) {
+        if (this == obj) {
             return true;
         }
-        if (!(o instanceof HandlingPriority)){
+        if (!(obj instanceof HandlingPriority)) {
             return false;
         }
 
-        HandlingPriority that = (HandlingPriority) o;
+        HandlingPriority that = (HandlingPriority) obj;
 
-        if (priority != null ? !priority.equals(that.priority) : that.priority != null){
+        if (priority != null ? !priority.equals(that.priority) : that.priority != null) {
             return false;
         }
 
index d1bba4085613c8a4a60f02f41cb11a5ccd3df825..445eb6d3d62923fb176c3adc7ba6172c5090fcaa 100644 (file)
@@ -17,11 +17,11 @@ import org.w3c.dom.Document;
  * operations are chained (ordered by HandlingPriority returned by canHandle
  * method) and executed.
  *
+ * <p>
  * Operation can be declared as singleton or last in chain (see abstract
  * implementations in netconf-util). If the operation is not singleton or last,
  * it is responsible for the execution of subsequent operation and for merging
  * the results.
- *
  */
 public interface NetconfOperation {
 
@@ -31,7 +31,7 @@ public interface NetconfOperation {
      * HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.
      *
      * @param message request message
-     * @return
+     * @return {@code handling priority}
      */
     HandlingPriority canHandle(Document message) throws DocumentedException;
 
@@ -42,11 +42,10 @@ public interface NetconfOperation {
      * last/singleton operation, subsequentOperation must indicate termination
      * point.
      *
-     * @param requestMessage
-     * @param subsequentOperation
-     *            execution of subsequent netconf operation
-     * @return
-     * @throws DocumentedException
+     * @param requestMessage request message
+     * @param subsequentOperation execution of subsequent netconf operation
+     * @return {@code document}
+     * @throws DocumentedException if operation fails
      */
     Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation)
             throws DocumentedException;
index 294482b0b5dcdc6d9b03f1b67ddfb7e94cb4c28b..1e57fc702154a394874ae8458cbc209e79e7ab66 100644 (file)
@@ -17,18 +17,20 @@ import org.w3c.dom.Document;
 public interface NetconfOperationChainedExecution {
 
     /**
+     * Check if this is termination point in operation execution.
+     *
      * @return true if this is termination point in operation execution, false
-     *         if there is a subsequent operation present that needs to be
-     *         executed
+     *     if there is a subsequent operation present that needs to be
+     *     executed.
      */
     boolean isExecutionTermination();
 
     /**
-     * Do not execute if this is termination point
+     * Do not execute if this is termination point.
      */
     Document execute(Document requestMessage) throws DocumentedException;
 
-    public static final NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() {
+    NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() {
         @Override
         public boolean isExecutionTermination() {
             return true;
@@ -36,7 +38,8 @@ public interface NetconfOperationChainedExecution {
 
         @Override
         public Document execute(Document requestMessage) throws DocumentedException {
-            throw new IllegalStateException("This execution represents the termination point in operation execution and cannot be executed itself");
+            throw new IllegalStateException("This execution represents the termination point in operation execution "
+                    + "and cannot be executed itself");
         }
     };
 
index 907bc2dca0307954475deecdc33de7ac92a9db22..f7f633de19e5f49b83579590aef4d25b4c811f42 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.netconf.mapping.api;
 import java.util.Set;
 
 /**
- *
+ * Service of netconf operations.
  */
 public interface NetconfOperationService extends AutoCloseable {
 
index 9e63f038db587476bd3e21252abb0d7a0be979e1..57d896e6ea083697ffcc4816f71027c4102c7fbe 100644 (file)
@@ -25,7 +25,8 @@ public interface NetconfOperationServiceFactory {
     Set<Capability> getCapabilities();
 
     /**
-     * Supported capabilities may change over time, registering a listener allows for push based information retrieval about current notifications
+     * Supported capabilities may change over time, registering a listener allows for push based information
+     * retrieval about current notifications.
      */
     AutoCloseable registerCapabilityListener(CapabilityListener listener);