Promote AbstractBindingLazyContainerNode 85/106485/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 14 Jun 2023 19:41:09 +0000 (21:41 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 19 Jun 2023 10:55:08 +0000 (10:55 +0000)
This is a well-proven class, drop the @Beta annotation and clean in up a
bit.

Change-Id: I7d6bd3e4717dd969695c58fe52e71d38911a4a24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec-spi/src/main/java/org/opendaylight/mdsal/binding/dom/codec/spi/AbstractBindingLazyContainerNode.java

index 17441bbfe8e9975d8fb56a6164a52061b6a6798a..cc65a621bc4a769ee47591650734dfce43766653 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.mdsal.binding.dom.codec.spi;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.annotations.Beta;
 import com.google.common.collect.ForwardingObject;
 import java.util.Collection;
 import org.checkerframework.checker.lock.qual.GuardedBy;
@@ -28,9 +27,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
  *
  * @param <T> Binding DataObject type
  * @param <C> Context type
- * @author Robert Varga
  */
-@Beta
 public abstract class AbstractBindingLazyContainerNode<T extends DataObject, C> extends ForwardingObject
         implements BindingLazyContainerNode<T> {
     private final @NonNull NodeIdentifier identifier;
@@ -48,29 +45,28 @@ public abstract class AbstractBindingLazyContainerNode<T extends DataObject, C>
     }
 
     @Override
-    public final @NonNull T getDataObject() {
+    public final T getDataObject() {
         return bindingData;
     }
 
     @Override
-    public final @NonNull NodeIdentifier name() {
+    public final NodeIdentifier name() {
         return identifier;
     }
 
     @Override
     @Deprecated(since = "12.0.0", forRemoval = true)
-    public final @NonNull NodeIdentifier getIdentifier() {
+    public final NodeIdentifier getIdentifier() {
         return identifier;
     }
 
-
     @Override
     public final ContainerNode getDelegate() {
         return delegate();
     }
 
     @Override
-    public Collection<DataContainerChild> body() {
+    public Collection<@NonNull DataContainerChild> body() {
         return delegate().body();
     }
 
@@ -96,29 +92,22 @@ public abstract class AbstractBindingLazyContainerNode<T extends DataObject, C>
     }
 
     @Override
-    public boolean equals(final @Nullable Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof ContainerNode other)) {
-            return false;
-        }
-        return delegate().equals(other);
+    public boolean equals(final Object obj) {
+        return this == obj || obj instanceof ContainerNode other && delegate().equals(other);
     }
 
     @Override
     protected final @NonNull ContainerNode delegate() {
-        ContainerNode local = delegate;
+        var local = delegate;
         if (local == null) {
             synchronized (this) {
                 local = delegate;
                 if (local == null) {
-                    local = delegate = requireNonNull(computeContainerNode(context));
+                    delegate = local = requireNonNull(computeContainerNode(context));
                     context = null;
                 }
             }
         }
-
         return local;
     }