Class CheckboxGroupOption

java.lang.Object
net.dv8tion.jda.api.components.checkboxgroup.CheckboxGroupOption
All Implemented Interfaces:
SerializableData

public final class CheckboxGroupOption extends Object implements SerializableData
An option of a CheckboxGroup.
  • Field Details

    • LABEL_MAX_LENGTH

      public static final int LABEL_MAX_LENGTH
      The maximum length a checkbox group option label can have.
      See Also:
    • VALUE_MAX_LENGTH

      public static final int VALUE_MAX_LENGTH
      The maximum length a checkbox group option value can have.
      See Also:
    • DESCRIPTION_MAX_LENGTH

      public static final int DESCRIPTION_MAX_LENGTH
      The maximum length a checkbox group option description can have.
      See Also:
  • Method Details

    • of

      @Nonnull public static CheckboxGroupOption of(@Nonnull String label, @Nonnull String value)
      Creates an unchecked checkbox group option.
      Parameters:
      label - The label to be displayed next to the checkbox, up to 100 characters
      value - The value associated to the option, this is what your bot will receive, up to 100 characters
      Returns:
      The new option
      Throws:
      IllegalArgumentException - If the label or value is null or blank, or one of them is longer than allowed
    • of

      @Nonnull public static CheckboxGroupOption of(@Nonnull String label, @Nonnull String value, @Nullable String description)
      Creates an unchecked checkbox group option.
      Parameters:
      label - The label to be displayed next to the checkbox, up to 100 characters
      value - The value associated to the option, this is what your bot will receive up to 100 characters
      description - The description of this checkbox, up to 100 characters
      Returns:
      The new option
      Throws:
      IllegalArgumentException - If the label or value is null or blank, or the description is blank, or one of them is longer than allowed
    • of

      @Nonnull public static CheckboxGroupOption of(@Nonnull String label, @Nonnull String value, @Nullable String description, boolean isDefault)
      Creates a checkbox group option.
      Parameters:
      label - The label to be displayed next to the checkbox, up to 100 characters
      value - The value associated to the option, this is what your bot will receive, up to 100 characters
      description - The description of this checkbox, up to 100 characters
      isDefault - Whether this option will be selected by default
      Returns:
      The new option
      Throws:
      IllegalArgumentException - If the label or value is null or blank, or the description is blank, or one of them is longer than allowed
    • withLabel

      @Nonnull @CheckReturnValue public CheckboxGroupOption withLabel(@Nonnull String label)
      Returns a copy of this checkbox group option with the changed label.
      Parameters:
      label - The label for the option, up to 100 characters
      Returns:
      The new checkbox group option instance
      Throws:
      IllegalArgumentException - If the label is null, empty, or longer than 100 characters
    • withValue

      @Nonnull @CheckReturnValue public CheckboxGroupOption withValue(@Nonnull String value)
      Returns a copy of this checkbox group option with the changed value.
      Parameters:
      value - The value associated to the option, this is what your bot will receive, up to 100 characters
      Returns:
      The new checkbox group option instance
      Throws:
      IllegalArgumentException - If the label is null, empty, or longer than 100 characters
    • withDescription

      @Nonnull @CheckReturnValue public CheckboxGroupOption withDescription(@Nullable String description)
      Returns a copy of this checkbox group option with the changed description of this option.
      Parameters:
      description - The new description or null to have no description, up to 100 characters
      Returns:
      The new checkbox group option instance
      Throws:
      IllegalArgumentException - If the provided description is longer than 100 characters
    • withDefault

      @Nonnull @CheckReturnValue public CheckboxGroupOption withDefault(boolean isDefault)
      Returns a copy of this checkbox group option with the changed default.
      Parameters:
      isDefault - Whether this option is selected by default
      Returns:
      The new checkbox group option instance
    • getLabel

      @Nonnull public String getLabel()
      Returns the label displayed next to the checkbox.
      Returns:
      The label
    • getValue

      @Nonnull public String getValue()
      Returns the value associated to this checkbox group option.
      Returns:
      The associated value
    • getDescription

      @Nullable public String getDescription()
      Returns the description of this option, or null if unset.
      Returns:
      The description, or null
    • isDefault

      public boolean isDefault()
      Whether this option is selected by default.
      Returns:
      true if this option is selected by default
    • fromData

      @Nonnull @CheckReturnValue public static CheckboxGroupOption fromData(@Nonnull DataObject data)
      Inverse function for toData() which parses the serialized option data
      Parameters:
      data - The serialized option data
      Returns:
      The parsed CheckboxGroupOption instance
      Throws:
      ParsingException - If the data representation is invalid
      IllegalArgumentException - If some part of the data has an invalid length or null is provided
    • 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 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