Class TextInputImpl

java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.textinput.TextInputImpl
All Implemented Interfaces:
ActionComponent, ActionRowChildComponent, ActionRowChildComponentUnion, IDisableable, Component, IComponentUnion, TextInput, SerializableData

public class TextInputImpl extends AbstractComponentImpl implements TextInput, ActionRowChildComponentUnion
  • Constructor Details

    • TextInputImpl

      public TextInputImpl(DataObject object)
    • TextInputImpl

      public TextInputImpl(String id, int uniqueId, TextInputStyle style, String label, int minLength, int maxLength, boolean required, String value, String placeholder)
  • Method Details

    • withUniqueId

      @Nonnull public TextInputImpl withUniqueId(int uniqueId)
      Description copied from interface: Component
      Creates a new component with the provided numeric ID.
      If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.
      Specified by:
      withUniqueId in interface ActionComponent
      Specified by:
      withUniqueId in interface ActionRowChildComponent
      Specified by:
      withUniqueId in interface ActionRowChildComponentUnion
      Specified by:
      withUniqueId in interface Component
      Specified by:
      withUniqueId in interface IComponentUnion
      Specified by:
      withUniqueId in interface IDisableable
      Specified by:
      withUniqueId in interface TextInput
      Parameters:
      uniqueId - The new ID; must be higher or equal to 1
      Returns:
      The new component
    • getStyle

      @Nonnull public TextInputStyle getStyle()
      Description copied from interface: TextInput
      The TextInputStyle of this TextInput component.
      Specified by:
      getStyle in interface TextInput
      Returns:
      The style of this TextInput component.
    • getCustomId

      @Nonnull public String getCustomId()
      Description copied from interface: TextInput
      The custom id of this TextInput component.

      This is used to uniquely identify the TextInput. Similar to Buttons.

      Specified by:
      getCustomId in interface ActionComponent
      Specified by:
      getCustomId in interface TextInput
      Returns:
      The custom id of this component.
      See Also:
    • getUniqueId

      public int getUniqueId()
      Description copied from interface: Component
      The unique, numeric identifier of this component.
      Can be set manually or automatically assigned by Discord (starting from 1). If it has not been assigned yet, this will return -1.

      Note: Older messages may return 0.

      Specified by:
      getUniqueId in interface Component
      Returns:
      The unique identifier of this component, or -1 if not assigned yet, or 0 on older messages
    • getLabel

      @Nonnull public String getLabel()
      Description copied from interface: TextInput
      The label of this TextInput component.
      Specified by:
      getLabel in interface TextInput
      Returns:
      The label of this TextInput component.
    • getMinLength

      public int getMinLength()
      Description copied from interface: TextInput
      The minimum amount of characters that must be written to submit the Modal.

      This is -1 if no length has been set!

      Specified by:
      getMinLength in interface TextInput
      Returns:
      The minimum length of this TextInput component or -1
    • getMaxLength

      public int getMaxLength()
      Description copied from interface: TextInput
      The maximum amount of characters that can be written to submit the Modal.

      This is -1 if no length has been set!

      Specified by:
      getMaxLength in interface TextInput
      Returns:
      The maximum length of this TextInput component or -1
    • isRequired

      public boolean isRequired()
      Description copied from interface: TextInput
      Whether this TextInput is required to be non-empty
      Specified by:
      isRequired in interface TextInput
      Returns:
      True if this TextInput is required to be used.
    • getValue

      @Nullable public String getValue()
      Description copied from interface: TextInput
      The pre-defined value of this TextInput component.
      If this is not null, sending a Modal with this component will pre-populate the field with this String.

      This is null if no pre-defined value has been set!

      Specified by:
      getValue in interface TextInput
      Returns:
      The value of this TextInput component or null.
    • getPlaceHolder

      @Nullable public String getPlaceHolder()
      Description copied from interface: TextInput
      The placeholder of this TextInput component.
      This is a short hint that describes the expected value of the TextInput field.

      This is null if no placeholder has been set!

      Specified by:
      getPlaceHolder in interface TextInput
      Returns:
      The placeholder of this TextInput component or null.
    • toData

      @Nonnull public DataObject toData()
      Description copied from interface: SerializableData
      Serialized DataObject for this object.
      Specified by:
      toData in interface SerializableData
      Returns:
      DataObject
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object