Record Class ButtonDefinition

java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.component.ButtonDefinition
Record Components:
clazzDescription - 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<Button>, com.github.kaktushose.jda.commands.definitions.features.internal.Invokable, JDAEntity<Button>, ComponentDefinition<Button>, InteractionDefinition

public record ButtonDefinition(@NotNull ClassDescription clazzDescription, @NotNull MethodDescription methodDescription, @NotNull Collection<String> permissions, @NotNull String label, @Nullable Emoji emoji, @Nullable String link, @NotNull ButtonStyle style) extends Record implements ComponentDefinition<Button>
Representation of a button.
  • Constructor Details

    • ButtonDefinition

      public ButtonDefinition(@NotNull @NotNull ClassDescription clazzDescription, @NotNull @NotNull MethodDescription methodDescription, @NotNull @NotNull Collection<String> permissions, @NotNull @NotNull String label, @Nullable @Nullable Emoji emoji, @Nullable @Nullable String link, @NotNull @NotNull ButtonStyle style)
      Creates an instance of a ButtonDefinition record class.
      Parameters:
      clazzDescription - the value for the clazzDescription 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 Button toJDAEntity()
      Transforms this definition to an Button with an independent custom id.
      Specified by:
      toJDAEntity in interface JDAEntity<Button>
      Returns:
      the Button
      See Also:
    • toJDAEntity

      @NotNull public @NotNull Button toJDAEntity(@NotNull @NotNull CustomId customId)
      Transforms this definition to an Button with the given CustomId.
      Specified by:
      toJDAEntity in interface CustomIdJDAEntity<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.
    • clazzDescription

      @NotNull public @NotNull ClassDescription clazzDescription()
      Returns the value of the clazzDescription record component.
      Specified by:
      clazzDescription in interface ComponentDefinition<Button>
      Specified by:
      clazzDescription in interface com.github.kaktushose.jda.commands.definitions.features.internal.Invokable
      Returns:
      the value of the clazzDescription record component
    • methodDescription

      @NotNull public @NotNull MethodDescription methodDescription()
      Returns the value of the methodDescription record component.
      Specified by:
      methodDescription in interface ComponentDefinition<Button>
      Specified by:
      methodDescription in interface com.github.kaktushose.jda.commands.definitions.features.internal.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 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 ButtonStyle style()
      Returns the value of the style record component.
      Returns:
      the value of the style record component