Record Class ModalDefinition

java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.definitions.interactions.ModalDefinition
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 modal
title - the title of the modal
components - a Collection of ModalTopLevelComponents that will be added to this modal
All Implemented Interfaces:
Definition, CustomIdJDAEntity<net.dv8tion.jda.api.modals.Modal>, Invokable, InteractionDefinition

public record ModalDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String title, Collection<net.dv8tion.jda.api.components.ModalTopLevelComponent> components) extends Record implements InteractionDefinition, CustomIdJDAEntity<net.dv8tion.jda.api.modals.Modal>
Representation of a modal.
  • Constructor Details

    • ModalDefinition

      public ModalDefinition(ClassDescription classDescription, MethodDescription methodDescription, Collection<String> permissions, String title, Collection<net.dv8tion.jda.api.components.ModalTopLevelComponent> components)
      Creates an instance of a ModalDefinition 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
      title - the value for the title record component
      components - the value for the components record component
  • Method Details

    • build

      public static ModalDefinition build(MethodBuildContext context)
      Builds a new ModalDefinition from the given MethodBuildContext.
      Returns:
      an Optional holding the ModalDefinition
    • with

      public ModalDefinition with(@Nullable String title, @Nullable Collection<net.dv8tion.jda.api.components.ModalTopLevelComponent> components)
      Builds a new ModalDefinition with the given values.
    • toJDAEntity

      public net.dv8tion.jda.api.modals.Modal toJDAEntity(CustomId customId)
      Transforms this definition to an Modal with the given custom id.
      Specified by:
      toJDAEntity in interface CustomIdJDAEntity<net.dv8tion.jda.api.modals.Modal>
      Parameters:
      customId - the CustomId to use to build this JDA entity
      Returns:
      the Modal
      See Also:
    • 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 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 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
    • title

      public String title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • components

      public Collection<net.dv8tion.jda.api.components.ModalTopLevelComponent> components()
      Returns the value of the components record component.
      Returns:
      the value of the components record component