Package dev.sympho.bot_utils.component
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 Summary
ConstructorsConstructorDescriptionHandler(ButtonManager.HandlerFunction handler, Group group) Creates an instance of aHandlerrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncompose(UnaryOperator<ButtonManager.HandlerFunction> transform) Composes this handler by transforming its handler function.final booleanIndicates whether some other object is "equal to" this one.group()Returns the value of thegrouprecord component.handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.static ButtonManager.Handlerof(ButtonManager.HandlerFunction handler) Creates a handler that uses the given function and requires no groups.static ButtonManager.Handlerof(ButtonManager.HandlerFunction handler, Group group) Creates a handler that uses the given function and requires the given group.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
compose
Description copied from interface:ComponentManager.HandlerComposes this handler by transforming its handler function.- Specified by:
composein interfaceComponentManager.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
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
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. All components in this record class are compared withObjects::equals(Object,Object). -
handler
Returns the value of thehandlerrecord component.- Specified by:
handlerin interfaceComponentManager.Handler<ButtonManager.Handler,ButtonManager.HandlerFunction> - Returns:
- the value of the
handlerrecord component
-
group
Returns the value of thegrouprecord component.- Returns:
- the value of the
grouprecord component
-