Record Class MaxInstancesPerChatConstraint
java.lang.Object
java.lang.Record
org.teleight.teleightbots.conversation.constraint.MaxInstancesPerChatConstraint
- All Implemented Interfaces:
ConversationInstanceConstraint
@NotNullByDefault
public record MaxInstancesPerChatConstraint(int limit)
extends Record
implements ConversationInstanceConstraint
-
Nested Class Summary
Nested classes/interfaces inherited from interface ConversationInstanceConstraint
ConversationInstanceConstraint.ConstraintResult -
Constructor Summary
ConstructorsConstructorDescriptionMaxInstancesPerChatConstraint(int limit) Creates an instance of aMaxInstancesPerChatConstraintrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncanJoin(Conversation conversation, Chat chat, Collection<ConversationContext> runningConversations) Determines whether a participant can join a specific conversation instance.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlimit()Returns the value of thelimitrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
MaxInstancesPerChatConstraint
public MaxInstancesPerChatConstraint(int limit) Creates an instance of aMaxInstancesPerChatConstraintrecord class.- Parameters:
limit- the value for thelimitrecord component
-
-
Method Details
-
canJoin
public ConversationInstanceConstraint.ConstraintResult canJoin(Conversation conversation, Chat chat, Collection<ConversationContext> runningConversations) Description copied from interface:ConversationInstanceConstraintDetermines whether a participant can join a specific conversation instance.- Specified by:
canJoinin interfaceConversationInstanceConstraint- Parameters:
conversation- the conversation instance to check.chat- the chat instance representing the context for the conversation.runningConversations- the currently active conversation contexts.- Returns:
- a
ConversationInstanceConstraint.ConstraintResultindicating whether the participant can join the conversation.
-
toString
-
hashCode
-
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. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
limit
public int limit()Returns the value of thelimitrecord component.- Returns:
- the value of the
limitrecord component
-