Package com.tnsai.coordination.decision
Record Class DecisionProposal
java.lang.Object
java.lang.Record
com.tnsai.coordination.decision.DecisionProposal
- Record Components:
id- Unique identifier for this proposaltopic- The question being decidedoptions- Available choicesmethod- Consensus algorithm to usetimeout- Maximum time to collect votesquorum- Minimum votes required for validitycreated- 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 Summary
ConstructorsConstructorDescriptionDecisionProposal(String id, String topic, List<String> options, VotingMethod method, Duration timeout, int quorum, Instant created) Creates an instance of aDecisionProposalrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncreated()Returns the value of thecreatedrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.method()Returns the value of themethodrecord component.static DecisionProposalCreates a proposal with default settings.static DecisionProposalof(String topic, List<String> options, VotingMethod method) Creates a proposal with a specific voting method.static DecisionProposalCreates a proposal with full configuration.options()Returns the value of theoptionsrecord component.intquorum()Returns the value of thequorumrecord 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.
-
Constructor Details
-
DecisionProposal
public DecisionProposal(String id, String topic, List<String> options, VotingMethod method, Duration timeout, int quorum, Instant created) Creates an instance of aDecisionProposalrecord class.- Parameters:
id- the value for theidrecord componenttopic- the value for thetopicrecord componentoptions- the value for theoptionsrecord componentmethod- the value for themethodrecord componenttimeout- the value for thetimeoutrecord componentquorum- the value for thequorumrecord componentcreated- the value for thecreatedrecord component
-
-
Method Details
-
of
Creates a proposal with default settings. -
of
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
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 '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
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
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-
timeout
Returns the value of thetimeoutrecord component.- Returns:
- the value of the
timeoutrecord component
-
quorum
public int quorum()Returns the value of thequorumrecord component.- Returns:
- the value of the
quorumrecord component
-
created
Returns the value of thecreatedrecord component.- Returns:
- the value of the
createdrecord component
-