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=122c96938e126fd25f25bdae4b1b2a1f8d5e83a0;hpb=ba87ed620f13823ee798fda4241a2c1db37e2f33;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 122c96938e..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; @@ -26,7 +27,8 @@ import org.opendaylight.yangtools.concepts.Identifier; * * @author Robert Varga */ -public abstract class AbstractIdentifiablePayload extends Payload implements Identifiable, Serializable { +public abstract class AbstractIdentifiablePayload + extends Payload implements Identifiable, Serializable { protected abstract static class AbstractProxy implements Externalizable { private static final long serialVersionUID = 1L; private byte[] serialized; @@ -37,7 +39,7 @@ public abstract class AbstractIdentifiablePayload extends } protected AbstractProxy(final byte[] serialized) { - this.serialized = Preconditions.checkNotNull(serialized); + this.serialized = requireNonNull(serialized); } @Override @@ -47,7 +49,7 @@ public abstract class AbstractIdentifiablePayload extends } @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); @@ -58,17 +60,19 @@ public abstract class AbstractIdentifiablePayload extends return Verify.verifyNotNull(createObject(identifier, serialized)); } - protected abstract @Nonnull T readIdentifier(@Nonnull DataInput in) throws IOException; - protected abstract @Nonnull Identifiable createObject(@Nonnull T identifier, @Nonnull byte[] serialized); + protected abstract @NonNull T readIdentifier(@NonNull DataInput in) throws IOException; + + @SuppressWarnings("checkstyle:hiddenField") + 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(final @Nonnull T identifier, final @Nonnull 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 @@ -85,5 +89,6 @@ public abstract class AbstractIdentifiablePayload extends return Verify.verifyNotNull(externalizableProxy(serialized)); } - protected abstract @Nonnull AbstractProxy externalizableProxy(@Nonnull byte[] serialized); + @SuppressWarnings("checkstyle:hiddenField") + protected abstract @NonNull AbstractProxy externalizableProxy(byte @NonNull[] serialized); }