Class ModalMapping

java.lang.Object
net.dv8tion.jda.api.interactions.modals.ModalMapping

public class ModalMapping extends Object
ID/Value pair for a ModalInteractionEvent.
See Also:
  • Constructor Details

    • ModalMapping

      public ModalMapping(net.dv8tion.jda.internal.interactions.InteractionImpl interaction, DataObject resolved, DataObject object)
  • Method Details

    • getCustomId

      @Nonnull public String getCustomId()
      The custom id of the component owning this data
      Returns:
      The custom id of the component
    • getUniqueId

      public int getUniqueId()
      The unique, numeric id of the component owning this data
      Returns:
      The numeric id of the component
    • getType

      @Nonnull public Component.Type getType()
      The Type of this component
      Returns:
      Type of this component
    • getAsString

      @Nonnull public String getAsString()
      The String representation of this component.

      For TextInputs, this returns what the User typed in it.

      Use getType() to check if this method can be used safely!

      Returns:
      The String representation of this component.
      Throws:
      IllegalStateException - If this ModalMapping cannot be represented as a String.
    • getAsStringList

      @Nonnull public List<String> getAsStringList()
      The String list representation of this component.

      Return values include:

      Use getType() to check if this method can be used safely!

      Returns:
      The string list representation of this component.
      Throws:
      IllegalStateException - If this ModalMapping cannot be represented as a List of Strings.
    • getAsLongList

      @Nonnull public List<Long> getAsLongList()
      Returns this component's value as a list of Longs.

      This is available if the component was an EntitySelectMenu.

      You can use getType() and Component.Type.isEntitySelectMenu() to check if this method can be used safely.

      Returns:
      This component's value as a list of Longs.
      Throws:
      IllegalStateException - If this ModalMapping cannot be represented as such
    • getAsMentions

      @Nonnull public Mentions getAsMentions()
      Returns this component's value as a Mentions object.

      This is available if the component was an EntitySelectMenu.

      You can use getType() and Component.Type.isEntitySelectMenu() to check if this method can be used safely.

      Returns:
      This component's value as a Mentions object.
      Throws:
      IllegalStateException - If this ModalMapping cannot be represented as such
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object