Fix warnings and clean up javadocs in sal-akka-raft
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / client / messages / FindLeaderReply.java
index b36ef112b364371d01d9e7f411fdf27761938606..5fbeb92fbdd0459d2ea5ff73a06f033935c77fe0 100644 (file)
@@ -8,14 +8,28 @@
 
 package org.opendaylight.controller.cluster.raft.client.messages;
 
-public class FindLeaderReply {
+import com.google.common.annotations.VisibleForTesting;
+import java.io.Serializable;
+import java.util.Optional;
+import javax.annotation.Nullable;
+
+/**
+ * Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which
+ * sent the message. If the responding actor does not have knowledge of the leader, {@link #getLeaderActor()} will
+ * return {@link Optional#empty()}.
+ * <p/>
+ * This message is intended for testing purposes only.
+ */
+@VisibleForTesting
+public final class FindLeaderReply implements Serializable {
+    private static final long serialVersionUID = 1L;
     private final String leaderActor;
 
-    public FindLeaderReply(String leaderActor) {
+    public FindLeaderReply(@Nullable final String leaderActor) {
         this.leaderActor = leaderActor;
     }
 
-    public String getLeaderActor() {
-        return leaderActor;
+    public Optional<String> getLeaderActor() {
+        return Optional.ofNullable(leaderActor);
     }
 }