Package com.tnsai.coordination.voting
Record Class VotingConfig
java.lang.Object
java.lang.Record
com.tnsai.coordination.voting.VotingConfig
- Record Components:
topic- The topic being voted onoptions- Available choicestimeout- Maximum time to wait for votesvotingMethod- How votes are talliedquorum- Minimum number of votes requiredsupermajorityThreshold- Threshold for supermajority (default 0.667)
public record VotingConfig(String topic, List<String> options, Duration timeout, VotingMethod votingMethod, int quorum, double supermajorityThreshold)
extends Record
Configuration for a voting session.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionVotingConfig(String topic, List<String> options, Duration timeout, VotingMethod votingMethod, int quorum, double supermajorityThreshold) Creates an instance of aVotingConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic VotingConfig.BuilderFluent builder for VotingConfig.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.options()Returns the value of theoptionsrecord component.intquorum()Returns the value of thequorumrecord component.doubleReturns the value of thesupermajorityThresholdrecord component.timeout()Returns the value of thetimeoutrecord component.topic()Returns the value of thetopicrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thevotingMethodrecord component.
-
Constructor Details
-
VotingConfig
public VotingConfig(String topic, List<String> options, Duration timeout, VotingMethod votingMethod, int quorum, double supermajorityThreshold) Creates an instance of aVotingConfigrecord class.- Parameters:
topic- the value for thetopicrecord componentoptions- the value for theoptionsrecord componenttimeout- the value for thetimeoutrecord componentvotingMethod- the value for thevotingMethodrecord componentquorum- the value for thequorumrecord componentsupermajorityThreshold- the value for thesupermajorityThresholdrecord component
-
-
Method Details
-
builder
Fluent builder for VotingConfig. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
topic
Returns the value of thetopicrecord component.- Returns:
- the value of the
topicrecord component
-
options
Returns the value of theoptionsrecord component.- Returns:
- the value of the
optionsrecord component
-
timeout
Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
votingMethod
Returns the value of thevotingMethodrecord component.- Returns:
- the value of the
votingMethodrecord component
-
quorum
public int quorum()Returns the value of thequorumrecord component.- Returns:
- the value of the
quorumrecord component
-
supermajorityThreshold
public double supermajorityThreshold()Returns the value of thesupermajorityThresholdrecord component.- Returns:
- the value of the
supermajorityThresholdrecord component
-