Record Class ButtonDefinition

java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.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
uniqueId - the uniqueId of this button
All Implemented Interfaces:
Definition, CustomIdJDAEntity<net.dv8tion.jda.api.components.buttons.Button>, Invokable, JDAEntity<net.dv8tion.jda.api.components.buttons.Button>, ComponentDefinition<net.dv8tion.jda.api.components.buttons.Button>, InteractionDefinition

public record ButtonDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String label, @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable String link, net.dv8tion.jda.api.components.buttons.ButtonStyle style, @Nullable Integer uniqueId) extends Record implements ComponentDefinition<net.dv8tion.jda.api.components.buttons.Button>
Representation of a button.
  • Constructor Details

    • ButtonDefinition

      public ButtonDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String label, @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable String link, net.dv8tion.jda.api.components.buttons.ButtonStyle style, @Nullable Integer uniqueId)
      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
      uniqueId - the value for the uniqueId record component
  • Method Details

    • build

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

      public ButtonDefinition with(@Nullable String label, @Nullable net.dv8tion.jda.api.entities.emoji.Emoji emoji, @Nullable String link, @Nullable net.dv8tion.jda.api.components.buttons.ButtonStyle style, @Nullable Integer uniqueId)
      Builds a new ButtonDefinition with the given values
    • toJDAEntity

      public net.dv8tion.jda.api.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.components.buttons.Button>
      Returns:
      the Button
      See Also:
    • toJDAEntity

      public net.dv8tion.jda.api.components.buttons.Button toJDAEntity(CustomId customId)
      Transforms this definition to an Button with the given CustomId.
      Specified by:
      toJDAEntity in interface CustomIdJDAEntity<net.dv8tion.jda.api.components.buttons.Button>
      Parameters:
      customId - the CustomId to use
      Returns:
      the Button
    • displayName

      public 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

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

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

      public 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

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

      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

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

      public net.dv8tion.jda.api.components.buttons.ButtonStyle style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component
    • uniqueId

      public @Nullable Integer uniqueId()
      Returns the value of the uniqueId record component.
      Specified by:
      uniqueId in interface ComponentDefinition<net.dv8tion.jda.api.components.buttons.Button>
      Returns:
      the value of the uniqueId record component