Record Class ButtonManager.HandlerEntry

java.lang.Object
java.lang.Record
dev.sympho.bot_utils.component.ButtonManager.HandlerEntry
Record Components:
id - The button ID.
handler - The handler to use.
mutex - If true, the given handler is converted into a mutex before registering.
All Implemented Interfaces:
ComponentManager.HandlerEntry<ButtonManager.Handler>
Enclosing class:
ButtonManager

public static record ButtonManager.HandlerEntry(String id, ButtonManager.Handler handler, boolean mutex) extends Record implements ComponentManager.HandlerEntry<ButtonManager.Handler>
Specification for a handler to be registered.
Since:
1.0
  • Constructor Details

    • HandlerEntry

      public HandlerEntry(String id, ButtonManager.Handler handler, boolean mutex)
      Creates an instance of a HandlerEntry record class.
      Parameters:
      id - the value for the id record component
      handler - the value for the handler record component
      mutex - the value for the mutex record component
  • Method Details

    • of

      public static ButtonManager.HandlerEntry of(String id, ButtonManager.HandlerFunction handler, boolean mutex, Group group)
      Creates a handler with the given ID that uses the given function and requires the given group.
      Parameters:
      id - The button ID.
      handler - The handler function to use.
      mutex - If true, the handler will be converted into a mutex before registering.
      group - The group that the user must have access to in order to use the button.
      Returns:
      The resulting handler.
    • of

      public static ButtonManager.HandlerEntry of(String id, ButtonManager.HandlerFunction handler, boolean mutex)
      Creates a handler with the given ID that uses the given function and requires no groups.
      Parameters:
      id - The button ID.
      handler - The handler function to use.
      mutex - If true, the handler will be converted into a mutex before registering.
      Returns:
      The resulting handler.
    • 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.
      Specified by:
      id in interface ComponentManager.HandlerEntry<ButtonManager.Handler>
      Returns:
      the value of the id record component
    • handler

      public ButtonManager.Handler handler()
      Returns the value of the handler record component.
      Specified by:
      handler in interface ComponentManager.HandlerEntry<ButtonManager.Handler>
      Returns:
      the value of the handler record component
    • mutex

      public boolean mutex()
      Returns the value of the mutex record component.
      Returns:
      the value of the mutex record component