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(DataObject object)
  • Method Details

    • getId

      @Nonnull @Deprecated @ForRemoval @ReplaceWith("getCustomId()") public String getId()
      Deprecated.
      Replaced with getCustomId()
      The custom id of this component
      Returns:
      The custom id of this component
    • 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.

      For StringSelectMenus, this returns the values chosen by the User.

      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.
    • 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