X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2Fpersisted%2FServerInfo.java;h=de70e17d3609d381451c9d3903a785620a3dfe5e;hb=HEAD;hp=c419f7e0f2dcf672ce00831ccdf8fab1a6186761;hpb=9d5ec5cdd146a56bc03e35b6718e9492a5c8410a;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerInfo.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerInfo.java index c419f7e0f2..de70e17d36 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerInfo.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerInfo.java @@ -7,8 +7,9 @@ */ package org.opendaylight.controller.cluster.raft.persisted; -import com.google.common.base.Preconditions; -import javax.annotation.Nonnull; +import static java.util.Objects.requireNonNull; + +import org.eclipse.jdt.annotation.NonNull; /** * Server information. This class is not directly Serializable, as it is serialized directly as part of @@ -16,48 +17,8 @@ import javax.annotation.Nonnull; * * @author Thomas Pantelis */ -public final class ServerInfo { - private final String id; - private final boolean isVoting; - - public ServerInfo(@Nonnull String id, boolean isVoting) { - this.id = Preconditions.checkNotNull(id); - this.isVoting = isVoting; - } - - @Nonnull - public String getId() { - return id; - } - - public boolean isVoting() { - return isVoting; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Boolean.hashCode(isVoting); - result = prime * result + id.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof ServerInfo)) { - return false; - } - - final ServerInfo other = (ServerInfo) obj; - return isVoting == other.isVoting && id.equals(other.id); - } - - @Override - public String toString() { - return "ServerInfo [id=" + id + ", isVoting=" + isVoting + "]"; +public record ServerInfo(@NonNull String peerId, boolean isVoting) { + public ServerInfo { + requireNonNull(peerId); } } \ No newline at end of file