Record Class ButtonDefinition
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.component.ButtonDefinition
- Record Components:
classDescription
- theClassDescription
of the declaring class of themethodDescription()
methodDescription
- theMethodDescription
of the method this definition is bound topermissions
- aCollection
of permissions for this buttonlabel
- the label of this buttonemoji
- theEmoji
of this button ornull
link
- the link of this button ornull
style
- theButtonStyle
of this button
- All Implemented Interfaces:
Definition
,CustomIdJDAEntity<net.dv8tion.jda.api.interactions.components.buttons.Button>
,Invokable
,JDAEntity<net.dv8tion.jda.api.interactions.components.buttons.Button>
,ComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
,InteractionDefinition
public record ButtonDefinition(@NotNull ClassDescription classDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String label, @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable String link, @NotNull net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style)
extends Record
implements ComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
Representation of a button.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.github.kaktushose.jda.commands.definitions.interactions.InteractionDefinition
InteractionDefinition.ReplyConfig
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionButtonDefinition
(@NotNull ClassDescription classDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String label, @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable String link, @NotNull net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style) Creates an instance of aButtonDefinition
record class. -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional
<ButtonDefinition> build
(MethodBuildContext context) Constructs a newButtonDefinition
from the givenMethodBuildContext
.@NotNull ClassDescription
Returns the value of theclassDescription
record component.@NotNull String
The human-readable name of this definition.@Nullable net.dv8tion.jda.api.entities.emoji.Emoji
emoji()
Returns the value of theemoji
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull String
label()
Returns the value of thelabel
record component.@Nullable String
link()
Returns the value of thelink
record component.@NotNull MethodDescription
Returns the value of themethodDescription
record component.@NotNull Collection
<String> Returns the value of thepermissions
record component.@NotNull net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle
style()
Returns the value of thestyle
record component.@NotNull net.dv8tion.jda.api.interactions.components.buttons.Button
Transforms this definition to anButton
with an independent custom id.@NotNull net.dv8tion.jda.api.interactions.components.buttons.Button
toJDAEntity
(@NotNull CustomId customId) Transforms this definition to anButton
with the givenCustomId
.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.kaktushose.jda.commands.definitions.interactions.InteractionDefinition
definitionId, newInstance, replyConfig
-
Constructor Details
-
ButtonDefinition
public ButtonDefinition(@NotNull @NotNull ClassDescription classDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String label, @Nullable @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable @Nullable String link, @NotNull @NotNull net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style) Creates an instance of aButtonDefinition
record class.- Parameters:
classDescription
- the value for theclassDescription
record componentmethodDescription
- the value for themethodDescription
record componentpermissions
- the value for thepermissions
record componentlabel
- the value for thelabel
record componentemoji
- the value for theemoji
record componentlink
- the value for thelink
record componentstyle
- the value for thestyle
record component
-
-
Method Details
-
build
Constructs a newButtonDefinition
from the givenMethodBuildContext
.- Returns:
- an
ButtonDefinition
holding theStringSelectMenuDefinition
-
toJDAEntity
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.Button toJDAEntity()Transforms this definition to anButton
with an independent custom id.- Specified by:
toJDAEntity
in interfaceJDAEntity<net.dv8tion.jda.api.interactions.components.buttons.Button>
- Returns:
- the
Button
- See Also:
-
toJDAEntity
@NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.Button toJDAEntity(@NotNull @NotNull CustomId customId) Transforms this definition to anButton
with the givenCustomId
.- Specified by:
toJDAEntity
in interfaceCustomIdJDAEntity<net.dv8tion.jda.api.interactions.components.buttons.Button>
- Parameters:
customId
- theCustomId
to use- Returns:
- the
Button
-
displayName
Description copied from interface:Definition
The human-readable name of this definition.- Specified by:
displayName
in interfaceDefinition
-
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 withObjects::equals(Object,Object)
. -
classDescription
Returns the value of theclassDescription
record component.- Specified by:
classDescription
in interfaceComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
- Specified by:
classDescription
in interfaceInvokable
- Returns:
- the value of the
classDescription
record component
-
methodDescription
Returns the value of themethodDescription
record component.- Specified by:
methodDescription
in interfaceComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
- Specified by:
methodDescription
in interfaceInvokable
- Returns:
- the value of the
methodDescription
record component
-
permissions
Returns the value of thepermissions
record component.- Specified by:
permissions
in interfaceInteractionDefinition
- Returns:
- the value of the
permissions
record component
-
label
-
emoji
-
link
-
style
-