*/
package org.opendaylight.controller.cluster.access.concepts;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.WritableIdentifier;
import org.opendaylight.yangtools.concepts.WritableObjects;
private long historyId;
private long cookie;
+ // checkstyle flags the public modifier as redundant however it is explicitly needed for Java serialization to
+ // be able to create instances via reflection.
+ @SuppressWarnings("checkstyle:RedundantModifier")
public Proxy() {
// For Externalizable
}
Proxy(final ClientIdentifier frontendId, final long historyId, final long cookie) {
- this.clientId = Preconditions.checkNotNull(frontendId);
+ clientId = requireNonNull(frontendId);
this.historyId = historyId;
this.cookie = cookie;
}
}
@Override
- public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal(final ObjectInput in) throws IOException {
clientId = ClientIdentifier.readFrom(in);
final byte header = WritableObjects.readLongHeader(in);
}
private static final long serialVersionUID = 1L;
- private final ClientIdentifier clientId;
+ private final @NonNull ClientIdentifier clientId;
private final long historyId;
private final long cookie;
}
public LocalHistoryIdentifier(final ClientIdentifier frontendId, final long historyId, final long cookie) {
- this.clientId = Preconditions.checkNotNull(frontendId);
+ clientId = requireNonNull(frontendId);
this.historyId = historyId;
this.cookie = cookie;
}
- public static LocalHistoryIdentifier readFrom(final DataInput in) throws IOException {
+ public static @NonNull LocalHistoryIdentifier readFrom(final DataInput in) throws IOException {
final ClientIdentifier clientId = ClientIdentifier.readFrom(in);
final byte header = WritableObjects.readLongHeader(in);
WritableObjects.writeLongs(out, historyId, cookie);
}
- public ClientIdentifier getClientId() {
+ public @NonNull ClientIdentifier getClientId() {
return clientId;
}
}
@Override
- public boolean equals(final Object o) {
- if (this == o) {
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
}
- if (!(o instanceof LocalHistoryIdentifier)) {
+ if (!(obj instanceof LocalHistoryIdentifier)) {
return false;
}
- final LocalHistoryIdentifier other = (LocalHistoryIdentifier) o;
+ final LocalHistoryIdentifier other = (LocalHistoryIdentifier) obj;
return historyId == other.historyId && cookie == other.cookie && clientId.equals(other.clientId);
}