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;
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;
@SuppressWarnings({ "rawtypes", "unchecked" })
LazyTreeNode(final TreeNodeCodecContext<D,?> 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
if (!Arrays.equals((byte[]) thisValue, (byte[]) otherValue)) {
return false;
}
- } else if (!Objects.equals(thisValue, otherValue)){
+ } else if (!Objects.equals(thisValue, otherValue)) {
return false;
}
}
private static Map<Class<? extends Augmentation<?>>, 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);
}
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;
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<DataContainerCodecContext<?,?>> augCtx= context.possibleStreamChild((Class) cls);
- if(augCtx.isPresent()) {
+ final Optional<DataContainerCodecContext<?,?>> augCtx = context.possibleStreamChild((Class) cls);
+ if (augCtx.isPresent()) {
final Optional<NormalizedNode<?, ?>> augData = data.getChild(augCtx.get().getDomPathArgument());
if (augData.isPresent()) {
return augCtx.get().deserialize(augData.get());
final LazyTreeNode<?> other = (LazyTreeNode<?>) obj;
return Objects.equals(context, other.context) && Objects.equals(data, other.data);
}
-}
\ No newline at end of file
+}