Record Class ButtonManager.Handler

java.lang.Object
java.lang.Record
dev.sympho.bot_utils.component.ButtonManager.Handler
Record Components:
handler - The handler function.
group - The group that the user must have access to in order to use the button.
All Implemented Interfaces:
ComponentManager.Handler<ButtonManager.Handler,ButtonManager.HandlerFunction>
Enclosing class:
ButtonManager

public static record ButtonManager.Handler(ButtonManager.HandlerFunction handler, Group group) extends Record implements ComponentManager.Handler<ButtonManager.Handler,ButtonManager.HandlerFunction>
Specification for the handling of a button.
Since:
1.0
  • Constructor Details

    • Handler

      public Handler(ButtonManager.HandlerFunction handler, Group group)
      Creates an instance of a Handler record class.
      Parameters:
      handler - the value for the handler record component
      group - the value for the group record component
  • Method Details

    • compose

      Description copied from interface: ComponentManager.Handler
      Composes this handler by transforming its handler function.
      Specified by:
      compose in interface ComponentManager.Handler<ButtonManager.Handler,ButtonManager.HandlerFunction>
      Parameters:
      transform - The function to apply on the handler.
      Returns:
      The Handler obtained by transforming this handler's function.
    • of

      public static ButtonManager.Handler of(ButtonManager.HandlerFunction handler, Group group)
      Creates a handler that uses the given function and requires the given group.
      Parameters:
      handler - The function to handle events with.
      group - The group that the user must have access to in order to use the button.
      Returns:
      The resulting handler.
    • of

      Creates a handler that uses the given function and requires no groups.
      Parameters:
      handler - The function to handle events with.
      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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • handler

      Returns the value of the handler record component.
      Specified by:
      handler in interface ComponentManager.Handler<ButtonManager.Handler,ButtonManager.HandlerFunction>
      Returns:
      the value of the handler record component
    • group

      public Group group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component