Reduce JSR305 proliferation
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / client / messages / FindLeaderReply.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft.client.messages;
9
10 import com.google.common.annotations.VisibleForTesting;
11 import java.io.Serializable;
12 import java.util.Optional;
13 import org.eclipse.jdt.annotation.Nullable;
14
15 /**
16  * Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which
17  * sent the message. If the responding actor does not have knowledge of the leader, {@link #getLeaderActor()} will
18  * return {@link Optional#empty()}.
19  *
20  * <p>
21  * This message is intended for testing purposes only.
22  */
23 @VisibleForTesting
24 public final class FindLeaderReply implements Serializable {
25     private static final long serialVersionUID = 1L;
26     private final String leaderActor;
27
28     public FindLeaderReply(final @Nullable String leaderActor) {
29         this.leaderActor = leaderActor;
30     }
31
32     public Optional<String> getLeaderActor() {
33         return Optional.ofNullable(leaderActor);
34     }
35 }