Record Class VotingConfig

java.lang.Object
java.lang.Record
com.tnsai.coordination.voting.VotingConfig
Record Components:
topic - The topic being voted on
options - Available choices
timeout - Maximum time to wait for votes
votingMethod - How votes are tallied
quorum - Minimum number of votes required
supermajorityThreshold - 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.
  • Constructor Details

    • VotingConfig

      public VotingConfig(String topic, List<String> options, Duration timeout, VotingMethod votingMethod, int quorum, double supermajorityThreshold)
      Creates an instance of a VotingConfig record class.
      Parameters:
      topic - the value for the topic record component
      options - the value for the options record component
      timeout - the value for the timeout record component
      votingMethod - the value for the votingMethod record component
      quorum - the value for the quorum record component
      supermajorityThreshold - the value for the supermajorityThreshold record component
  • Method Details

    • builder

      public static VotingConfig.Builder builder(String topic)
      Fluent builder for VotingConfig.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • topic

      public String topic()
      Returns the value of the topic record component.
      Returns:
      the value of the topic record component
    • options

      public List<String> options()
      Returns the value of the options record component.
      Returns:
      the value of the options record component
    • timeout

      public Duration timeout()
      Returns the value of the timeout record component.
      Returns:
      the value of the timeout record component
    • votingMethod

      public VotingMethod votingMethod()
      Returns the value of the votingMethod record component.
      Returns:
      the value of the votingMethod record component
    • quorum

      public int quorum()
      Returns the value of the quorum record component.
      Returns:
      the value of the quorum record component
    • supermajorityThreshold

      public double supermajorityThreshold()
      Returns the value of the supermajorityThreshold record component.
      Returns:
      the value of the supermajorityThreshold record component