Cleanup PathArgumentTypes 23/84323/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 11 Sep 2019 13:09:13 +0000 (15:09 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 11 Sep 2019 15:12:14 +0000 (17:12 +0200)
Do not use long qualifiers for individual types, preferring
importing them. Also drop public modifiers, as this class is
package-private. Finally import static checkArgument().

Change-Id: I267d0f5675911b2d9990e8f7c3fdd49265c10d8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/PathArgumentTypes.java

index b372d8f..07ed12a 100644 (file)
@@ -5,34 +5,37 @@
  * 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.controller.cluster.datastore.node.utils.stream;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.collect.ImmutableMap;
 import java.util.Map;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 final class PathArgumentTypes {
-    public static final byte AUGMENTATION_IDENTIFIER = 1;
-    public static final byte NODE_IDENTIFIER = 2;
-    public static final byte NODE_IDENTIFIER_WITH_VALUE = 3;
-    public static final byte NODE_IDENTIFIER_WITH_PREDICATES = 4;
+    static final byte AUGMENTATION_IDENTIFIER = 1;
+    static final byte NODE_IDENTIFIER = 2;
+    static final byte NODE_IDENTIFIER_WITH_VALUE = 3;
+    static final byte NODE_IDENTIFIER_WITH_PREDICATES = 4;
 
     private PathArgumentTypes() {
         throw new UnsupportedOperationException("Utility class");
     }
 
     private static final Map<Class<?>, Byte> CLASS_TO_ENUM_MAP = ImmutableMap.<Class<?>, Byte>builder()
-            .put(YangInstanceIdentifier.AugmentationIdentifier.class, AUGMENTATION_IDENTIFIER)
-            .put(YangInstanceIdentifier.NodeIdentifier.class, NODE_IDENTIFIER)
-            .put(YangInstanceIdentifier.NodeIdentifierWithPredicates.class, NODE_IDENTIFIER_WITH_PREDICATES)
-            .put(YangInstanceIdentifier.NodeWithValue.class, NODE_IDENTIFIER_WITH_VALUE).build();
+            .put(AugmentationIdentifier.class, AUGMENTATION_IDENTIFIER)
+            .put(NodeIdentifier.class, NODE_IDENTIFIER)
+            .put(NodeIdentifierWithPredicates.class, NODE_IDENTIFIER_WITH_PREDICATES)
+            .put(NodeWithValue.class, NODE_IDENTIFIER_WITH_VALUE).build();
 
-    public static byte getSerializablePathArgumentType(YangInstanceIdentifier.PathArgument pathArgument) {
+    static byte getSerializablePathArgumentType(final PathArgument pathArgument) {
         final Byte type = CLASS_TO_ENUM_MAP.get(pathArgument.getClass());
-        Preconditions.checkArgument(type != null, "Unknown type of PathArgument = %s", pathArgument);
+        checkArgument(type != null, "Unknown type of PathArgument = %s", pathArgument);
         return type;
     }
-
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.