Package io.atomix.raft.protocol
Class PollResponse.Builder
java.lang.Object
io.atomix.raft.protocol.AbstractRaftResponse.Builder<PollResponse.Builder,PollResponse>
io.atomix.raft.protocol.PollResponse.Builder
- All Implemented Interfaces:
RaftResponse.Builder<PollResponse.Builder,,PollResponse> Builder<PollResponse>
- Enclosing class:
PollResponse
public static class PollResponse.Builder
extends AbstractRaftResponse.Builder<PollResponse.Builder,PollResponse>
Poll response builder.
-
Field Summary
Fields inherited from class io.atomix.raft.protocol.AbstractRaftResponse.Builder
error, status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected voidvalidate()Validates the builder.withAccepted(boolean accepted) Sets whether the poll was granted.withTerm(long term) Sets the response term.Methods inherited from class io.atomix.raft.protocol.AbstractRaftResponse.Builder
toString, withError, withStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.atomix.raft.protocol.RaftResponse.Builder
withError, withError
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withTerm
Sets the response term.- Parameters:
term- The response term.- Returns:
- The poll response builder.
- Throws:
IllegalArgumentException- iftermis not positive
-
withAccepted
Sets whether the poll was granted.- Parameters:
accepted- Whether the poll was granted.- Returns:
- The poll response builder.
-
build
-
validate
protected void validate()Description copied from class:AbstractRaftResponse.BuilderValidates the builder.- Overrides:
validatein classAbstractRaftResponse.Builder<PollResponse.Builder,PollResponse>
-