Fix StatementRepresentation javadoc
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / RegistrationTreeNode.java
index ca3da5c7865ad6c80dde2765786bfe92abc6530d..f89dce93d62625f6bcae7838c485db7a59698545 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.mdsal.dom.spi;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
@@ -16,7 +17,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -59,8 +60,8 @@ public final class RegistrationTreeNode<T> implements Identifiable<PathArgument>
      * @param arg Child identifier
      * @return Child matching exactly, or null.
      */
-    public RegistrationTreeNode<T> getExactChild(@Nonnull final PathArgument arg) {
-        return children.get(Preconditions.checkNotNull(arg));
+    public RegistrationTreeNode<T> getExactChild(final @NonNull PathArgument arg) {
+        return children.get(requireNonNull(arg));
     }
 
     /**
@@ -70,8 +71,8 @@ public final class RegistrationTreeNode<T> implements Identifiable<PathArgument>
      * @param arg Child identifier
      * @return Collection of children, guaranteed to be non-null.
      */
-    public @Nonnull Collection<RegistrationTreeNode<T>> getInexactChildren(@Nonnull final PathArgument arg) {
-        Preconditions.checkNotNull(arg);
+    public @NonNull Collection<RegistrationTreeNode<T>> getInexactChildren(final @NonNull PathArgument arg) {
+        requireNonNull(arg);
         if (arg instanceof NodeWithValue || arg instanceof NodeIdentifierWithPredicates) {
             /*
              * TODO: This just all-or-nothing wildcards, which we have historically supported. Given
@@ -82,34 +83,34 @@ public final class RegistrationTreeNode<T> implements Identifiable<PathArgument>
             final RegistrationTreeNode<T> child = children.get(new NodeIdentifier(arg.getNodeType()));
             if (child == null) {
                 return Collections.emptyList();
-            } else {
-                return Collections.singletonList(child);
             }
-        } else {
-            return Collections.emptyList();
+
+            return Collections.singletonList(child);
         }
+
+        return Collections.emptyList();
     }
 
     public Collection<T> getRegistrations() {
         return publicRegistrations;
     }
 
-    RegistrationTreeNode<T> ensureChild(@Nonnull final PathArgument child) {
-        RegistrationTreeNode<T> potential = children.get(Preconditions.checkNotNull(child));
+    RegistrationTreeNode<T> ensureChild(final @NonNull PathArgument child) {
+        RegistrationTreeNode<T> potential = children.get(requireNonNull(child));
         if (potential == null) {
-            potential = new RegistrationTreeNode<T>(this, child);
+            potential = new RegistrationTreeNode<>(this, child);
             children.put(child, potential);
         }
         return potential;
     }
 
-    void addRegistration(@Nonnull final T registration) {
-        registrations.add(Preconditions.checkNotNull(registration));
+    void addRegistration(final @NonNull T registration) {
+        registrations.add(requireNonNull(registration));
         LOG.debug("Registration {} added", registration);
     }
 
-    void removeRegistration(@Nonnull final T registration) {
-        registrations.remove(Preconditions.checkNotNull(registration));
+    void removeRegistration(final @NonNull T registration) {
+        registrations.remove(requireNonNull(registration));
         LOG.debug("Registration {} removed", registration);
 
         // We have been called with the write-lock held, so we can perform some cleanup.