X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding2%2Fmdsal-binding2-dom-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fjavav2%2Fdom%2Fcodec%2Fimpl%2Fcontext%2Fbase%2FLazyTreeNode.java;h=ef7d8133d6ff9551db0b1d1ea7e58383cdf3d188;hb=a90276953f9ce9d539af868116059e14d656fc50;hp=288622ebabc287555841d7b0268dac3f91d19621;hpb=397b1239e991457b0e0605bec78faf2a5c2f73b8;p=mdsal.git diff --git a/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/base/LazyTreeNode.java b/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/base/LazyTreeNode.java index 288622ebab..ef7d8133d6 100644 --- a/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/base/LazyTreeNode.java +++ b/binding2/mdsal-binding2-dom-codec/src/main/java/org/opendaylight/mdsal/binding/javav2/dom/codec/impl/context/base/LazyTreeNode.java @@ -8,10 +8,11 @@ package org.opendaylight.mdsal.binding.javav2.dom.codec.impl.context.base; +import static java.util.Objects.requireNonNull; + import com.google.common.annotations.Beta; import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects.ToStringHelper; -import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import java.lang.reflect.InvocationHandler; @@ -21,6 +22,7 @@ import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import org.opendaylight.mdsal.binding.javav2.dom.codec.api.AugmentationReader; import org.opendaylight.mdsal.binding.javav2.runtime.reflection.BindingReflections; @@ -54,8 +56,8 @@ class LazyTreeNode implements InvocationHandler, Augmentatio @SuppressWarnings({ "rawtypes", "unchecked" }) LazyTreeNode(final TreeNodeCodecContext ctx, final NormalizedNodeContainer data) { - this.context = Preconditions.checkNotNull(ctx, "Context must not be null"); - this.data = Preconditions.checkNotNull(data, "Data must not be null"); + this.context = requireNonNull(ctx, "Context must not be null"); + this.data = requireNonNull(data, "Data must not be null"); } @Override @@ -99,7 +101,7 @@ class LazyTreeNode implements InvocationHandler, Augmentatio if (!Arrays.equals((byte[]) thisValue, (byte[]) otherValue)) { return false; } - } else if (!Objects.equals(thisValue, otherValue)){ + } else if (!Objects.equals(thisValue, otherValue)) { return false; } } @@ -119,7 +121,7 @@ class LazyTreeNode implements InvocationHandler, Augmentatio private static Map>, Augmentation> getAllAugmentations(final Object dataObject) { if (dataObject instanceof AugmentationReader) { return ((AugmentationReader) dataObject).getAugmentations(dataObject); - } else if (dataObject instanceof Augmentable){ + } else if (dataObject instanceof Augmentable) { return BindingReflections.getAugmentations((Augmentable) dataObject); } @@ -139,7 +141,7 @@ class LazyTreeNode implements InvocationHandler, Augmentatio result = prime * result + Objects.hashCode(value); } if (Augmentable.class.isAssignableFrom(context.getBindingClass())) { - result = prime * result + (getAugmentationsImpl().hashCode()); + result = prime * result + getAugmentationsImpl().hashCode(); } cachedHashcode = result; return result; @@ -188,11 +190,11 @@ class LazyTreeNode implements InvocationHandler, Augmentatio if (aug != null) { return aug.get(cls); } - Preconditions.checkNotNull(cls,"Supplied augmentation must not be null."); + requireNonNull(cls,"Supplied augmentation must not be null."); @SuppressWarnings({"unchecked","rawtypes"}) - final Optional> augCtx= context.possibleStreamChild((Class) cls); - if(augCtx.isPresent()) { + final Optional> augCtx = context.possibleStreamChild((Class) cls); + if (augCtx.isPresent()) { final Optional> augData = data.getChild(augCtx.get().getDomPathArgument()); if (augData.isPresent()) { return augCtx.get().deserialize(augData.get()); @@ -232,4 +234,4 @@ class LazyTreeNode implements InvocationHandler, Augmentatio final LazyTreeNode other = (LazyTreeNode) obj; return Objects.equals(context, other.context) && Objects.equals(data, other.data); } -} \ No newline at end of file +}