Class CheckboxGroupOption
java.lang.Object
net.dv8tion.jda.api.components.checkboxgroup.CheckboxGroupOption
- All Implemented Interfaces:
SerializableData
An option of a
CheckboxGroup.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum length a checkbox group option description can have.static final intThe maximum length a checkbox group option label can have.static final intThe maximum length a checkbox group option value can have. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic CheckboxGroupOptionfromData(DataObject data) Inverse function fortoData()which parses the serialized option dataReturns the description of this option, ornullif unset.getLabel()Returns the label displayed next to the checkbox.getValue()Returns the value associated to this checkbox group option.inthashCode()booleanWhether this option is selected by default.static CheckboxGroupOptionCreates an unchecked checkbox group option.static CheckboxGroupOptionCreates an unchecked checkbox group option.static CheckboxGroupOptionCreates a checkbox group option.toData()SerializedDataObjectfor this object.toString()withDefault(boolean isDefault) Returns a copy of this checkbox group option with the changed default.withDescription(String description) Returns a copy of this checkbox group option with the changed description of this option.Returns a copy of this checkbox group option with the changed label.Returns a copy of this checkbox group option with the changed value.
-
Field Details
-
LABEL_MAX_LENGTH
public static final int LABEL_MAX_LENGTHThe maximum length a checkbox group option label can have.- See Also:
-
VALUE_MAX_LENGTH
public static final int VALUE_MAX_LENGTHThe maximum length a checkbox group option value can have.- See Also:
-
DESCRIPTION_MAX_LENGTH
public static final int DESCRIPTION_MAX_LENGTHThe maximum length a checkbox group option description can have.- See Also:
-
-
Method Details
-
of
Creates an unchecked checkbox group option.- Parameters:
label- The label to be displayed next to the checkbox, up to 100 charactersvalue- 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 isnullor 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 charactersvalue- The value associated to the option, this is what your bot will receive up to 100 charactersdescription- The description of this checkbox, up to 100 characters- Returns:
- The new option
- Throws:
IllegalArgumentException- If the label or value isnullor 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 charactersvalue- The value associated to the option, this is what your bot will receive, up to 100 charactersdescription- The description of this checkbox, up to 100 charactersisDefault- Whether this option will be selected by default- Returns:
- The new option
- Throws:
IllegalArgumentException- If the label or value isnullor blank, or the description is blank, or one of them is longer than allowed
-
withLabel
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
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
Returns a copy of this checkbox group option with the changed description of this option.- Parameters:
description- The new description ornullto 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
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
Returns the label displayed next to the checkbox.- Returns:
- The label
-
getValue
Returns the value associated to this checkbox group option.- Returns:
- The associated value
-
getDescription
Returns the description of this option, ornullif unset.- Returns:
- The description, or
null
-
isDefault
public boolean isDefault()Whether this option is selected by default.- Returns:
trueif this option is selected by default
-
fromData
Inverse function fortoData()which parses the serialized option data- Parameters:
data- The serialized option data- Returns:
- The parsed CheckboxGroupOption instance
- Throws:
ParsingException- If the data representation is invalidIllegalArgumentException- If some part of the data has an invalid length or null is provided
-
toData
Description copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
toDatain interfaceSerializableData- Returns:
DataObject
-
equals
-
hashCode
-
toString
-