Fix checkstyle issues to enforce it
[controller.git] / opendaylight / config / config-manager-facade-xml / src / main / java / org / opendaylight / controller / config / facade / xml / strategy / EditStrategyType.java
index 9954592b0a624268f446cfe20ae7e12174533b5d..bf11f2a13770b3403f56563e64080ab49ff79980 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2015, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -19,7 +19,7 @@ public enum EditStrategyType {
     // additional per element
     delete, remove, recreate;
 
-    private static final Set<EditStrategyType> defaultStrats = EnumSet.of(merge, replace, none);
+    private static final Set<EditStrategyType> DEFAULT_STRATS = EnumSet.of(merge, replace, none);
 
     public static EditStrategyType getDefaultStrategy() {
         return merge;
@@ -27,50 +27,50 @@ public enum EditStrategyType {
 
     public boolean isEnforcing() {
         switch (this) {
-        case merge:
-        case none:
-        case remove:
-        case delete:
-        case recreate:
-            return false;
-        case replace:
-            return true;
+            case merge:
+            case none:
+            case remove:
+            case delete:
+            case recreate:
+                return false;
+            case replace:
+                return true;
 
-        default:
-            throw new IllegalStateException("Default edit strategy can be only of value " + defaultStrats + " but was "
-                    + this);
+            default:
+                throw new IllegalStateException(
+                    "Default edit strategy can be only of value " + DEFAULT_STRATS + " but was " + this);
         }
     }
+
     public static void compareParsedStrategyToDefaultEnforcing(EditStrategyType parsedStrategy,
-                                                                  EditStrategyType defaultStrategy) throws OperationNotPermittedException {
+            EditStrategyType defaultStrategy) throws OperationNotPermittedException {
         if (defaultStrategy.isEnforcing()) {
-            if (parsedStrategy != defaultStrategy){
-                throw new OperationNotPermittedException(String.format("With "
-                        + defaultStrategy
-                        + " as default-operation operations on module elements are not permitted since the default option is restrictive"),
-                        DocumentedException.ErrorType.APPLICATION,
-                        DocumentedException.ErrorTag.OPERATION_FAILED,
+            if (parsedStrategy != defaultStrategy) {
+                throw new OperationNotPermittedException(String.format("With " + defaultStrategy
+                        + " as default-operation operations on module elements are not permitted"
+                        + "since the default option is restrictive"),
+                        DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
                         DocumentedException.ErrorSeverity.ERROR);
             }
         }
-
     }
+
     public EditConfigStrategy getFittingStrategy() {
         switch (this) {
-        case merge:
-            return new MergeEditConfigStrategy();
-        case replace:
-            return new ReplaceEditConfigStrategy();
-        case delete:
-            return new DeleteEditConfigStrategy();
-        case remove:
-            return new RemoveEditConfigStrategy();
-        case recreate:
-            return new ReCreateEditConfigStrategy();
-        case none:
-            return new NoneEditConfigStrategy();
-        default:
-            throw new UnsupportedOperationException("Unimplemented edit config strategy" + this);
+            case merge:
+                return new MergeEditConfigStrategy();
+            case replace:
+                return new ReplaceEditConfigStrategy();
+            case delete:
+                return new DeleteEditConfigStrategy();
+            case remove:
+                return new RemoveEditConfigStrategy();
+            case recreate:
+                return new ReCreateEditConfigStrategy();
+            case none:
+                return new NoneEditConfigStrategy();
+            default:
+                throw new UnsupportedOperationException("Unimplemented edit config strategy" + this);
         }
     }
 }