X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fpersisted%2FAbstractIdentifiablePayload.java;h=4ca35098c5b4d6189adf006ec3444de689397001;hb=c9587253579a7b34f4c397a254f83890d4d3ba03;hp=b0ad960cb84af19642cdd8571ee48ba6b5fbe684;hpb=2d60632f7cf63712e8357a3cf3fc40d83366e5e6;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java index b0ad960cb8..4ca35098c5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/persisted/AbstractIdentifiablePayload.java @@ -7,7 +7,8 @@ */ package org.opendaylight.controller.cluster.datastore.persisted; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + import com.google.common.base.Verify; import com.google.common.io.ByteStreams; import java.io.DataInput; @@ -16,7 +17,7 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.Serializable; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; import org.opendaylight.yangtools.concepts.Identifiable; import org.opendaylight.yangtools.concepts.Identifier; @@ -38,7 +39,7 @@ public abstract class AbstractIdentifiablePayload } protected AbstractProxy(final byte[] serialized) { - this.serialized = Preconditions.checkNotNull(serialized); + this.serialized = requireNonNull(serialized); } @Override @@ -48,7 +49,7 @@ public abstract class AbstractIdentifiablePayload } @Override - public final void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { + public final void readExternal(final ObjectInput in) throws IOException { final int length = in.readInt(); serialized = new byte[length]; in.readFully(serialized); @@ -59,21 +60,19 @@ public abstract class AbstractIdentifiablePayload return Verify.verifyNotNull(createObject(identifier, serialized)); } - @Nonnull - protected abstract T readIdentifier(@Nonnull DataInput in) throws IOException; + protected abstract @NonNull T readIdentifier(@NonNull DataInput in) throws IOException; - @Nonnull @SuppressWarnings("checkstyle:hiddenField") - protected abstract Identifiable createObject(@Nonnull T identifier, @Nonnull byte[] serialized); + protected abstract @NonNull Identifiable createObject(@NonNull T identifier, byte @NonNull[] serialized); } private static final long serialVersionUID = 1L; private final byte[] serialized; private final T identifier; - AbstractIdentifiablePayload(@Nonnull final T identifier, @Nonnull final byte[] serialized) { - this.identifier = Preconditions.checkNotNull(identifier); - this.serialized = Preconditions.checkNotNull(serialized); + AbstractIdentifiablePayload(final @NonNull T identifier, final byte @NonNull[] serialized) { + this.identifier = requireNonNull(identifier); + this.serialized = requireNonNull(serialized); } @Override @@ -90,7 +89,6 @@ public abstract class AbstractIdentifiablePayload return Verify.verifyNotNull(externalizableProxy(serialized)); } - @Nonnull @SuppressWarnings("checkstyle:hiddenField") - protected abstract AbstractProxy externalizableProxy(@Nonnull byte[] serialized); + protected abstract @NonNull AbstractProxy externalizableProxy(byte @NonNull[] serialized); }