Record Class ButtonDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.component.ButtonDefinition
Record Components:
classDescription - the ClassDescription of the declaring class of the methodDescription()
methodDescription - the MethodDescription of the method this definition is bound to
permissions - a Collection of permissions for this button
label - the label of this button
emoji - the Emoji of this button or null
link - the link of this button or null
style - the ButtonStyle 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.
  • 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 a ButtonDefinition record class.
      Parameters:
      classDescription - the value for the classDescription record component
      methodDescription - the value for the methodDescription record component
      permissions - the value for the permissions record component
      label - the value for the label record component
      emoji - the value for the emoji record component
      link - the value for the link record component
      style - the value for the style record component
  • Method Details

    • build

      public static Optional<ButtonDefinition> build(MethodBuildContext context)
      Constructs a new ButtonDefinition from the given MethodBuildContext.
      Returns:
      an ButtonDefinition holding the StringSelectMenuDefinition
    • toJDAEntity

      @NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.Button toJDAEntity()
      Transforms this definition to an Button with an independent custom id.
      Specified by:
      toJDAEntity in interface JDAEntity<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 an Button with the given CustomId.
      Specified by:
      toJDAEntity in interface CustomIdJDAEntity<net.dv8tion.jda.api.interactions.components.buttons.Button>
      Parameters:
      customId - the CustomId to use
      Returns:
      the Button
    • displayName

      @NotNull public @NotNull String displayName()
      Description copied from interface: Definition
      The human-readable name of this definition.
      Specified by:
      displayName in interface Definition
    • 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.
    • classDescription

      @NotNull public @NotNull ClassDescription classDescription()
      Returns the value of the classDescription record component.
      Specified by:
      classDescription in interface ComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
      Specified by:
      classDescription in interface Invokable
      Returns:
      the value of the classDescription record component
    • methodDescription

      @NotNull public @NotNull MethodDescription methodDescription()
      Returns the value of the methodDescription record component.
      Specified by:
      methodDescription in interface ComponentDefinition<net.dv8tion.jda.api.interactions.components.buttons.Button>
      Specified by:
      methodDescription in interface Invokable
      Returns:
      the value of the methodDescription record component
    • permissions

      @NotNull public @NotNull Collection<String> permissions()
      Returns the value of the permissions record component.
      Specified by:
      permissions in interface InteractionDefinition
      Returns:
      the value of the permissions record component
    • label

      @NotNull public @NotNull String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • emoji

      @Nullable public @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji()
      Returns the value of the emoji record component.
      Returns:
      the value of the emoji record component
    • link

      @Nullable public @Nullable String link()
      Returns the value of the link record component.
      Returns:
      the value of the link record component
    • style

      @NotNull public @NotNull net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component