Record Class DecisionProposal

java.lang.Object
java.lang.Record
com.tnsai.coordination.decision.DecisionProposal
Record Components:
id - Unique identifier for this proposal
topic - The question being decided
options - Available choices
method - Consensus algorithm to use
timeout - Maximum time to collect votes
quorum - Minimum votes required for validity
created - When the proposal was created

public record DecisionProposal(String id, String topic, List<String> options, VotingMethod method, Duration timeout, int quorum, Instant created) extends Record
A proposal submitted for group decision-making.
  • Constructor Details

    • DecisionProposal

      public DecisionProposal(String id, String topic, List<String> options, VotingMethod method, Duration timeout, int quorum, Instant created)
      Creates an instance of a DecisionProposal record class.
      Parameters:
      id - the value for the id record component
      topic - the value for the topic record component
      options - the value for the options record component
      method - the value for the method record component
      timeout - the value for the timeout record component
      quorum - the value for the quorum record component
      created - the value for the created record component
  • Method Details

    • of

      public static DecisionProposal of(String topic, List<String> options)
      Creates a proposal with default settings.
    • of

      public static DecisionProposal of(String topic, List<String> options, VotingMethod method)
      Creates a proposal with a specific voting method.
    • of

      public static DecisionProposal of(String topic, List<String> options, VotingMethod method, Duration timeout, int quorum)
      Creates a proposal with full configuration.
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • 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
    • method

      public VotingMethod method()
      Returns the value of the method record component.
      Returns:
      the value of the method record component
    • timeout

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

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

      public Instant created()
      Returns the value of the created record component.
      Returns:
      the value of the created record component