Class RadioGroupOption
java.lang.Object
net.dv8tion.jda.api.components.radiogroup.RadioGroupOption
- All Implemented Interfaces:
SerializableData
An option of a
RadioGroup.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum length a radio group option description can have.static final intThe maximum length a radio group option label can have.static final intThe maximum length a radio group option value can have. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic RadioGroupOptionfromData(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 radio button.getValue()Returns the value associated to this radio group option.inthashCode()booleanWhether this option is selected by default.static RadioGroupOptionCreates an unchecked radio group option.static RadioGroupOptionCreates an unchecked radio group option.static RadioGroupOptionCreates a radio group option.toData()SerializedDataObjectfor this object.toString()withDefault(boolean isDefault) Returns a copy of this radio group option with the changed default.withDescription(String description) Returns a copy of this radio group option with the changed description of this option.Returns a copy of this radio group option with the changed label.Returns a copy of this radio group option with the changed value.
-
Field Details
-
LABEL_MAX_LENGTH
public static final int LABEL_MAX_LENGTHThe maximum length a radio group option label can have.- See Also:
-
VALUE_MAX_LENGTH
public static final int VALUE_MAX_LENGTHThe maximum length a radio group option value can have.- See Also:
-
DESCRIPTION_MAX_LENGTH
public static final int DESCRIPTION_MAX_LENGTHThe maximum length a radio group option description can have.- See Also:
-
-
Method Details
-
of
Creates an unchecked radio group option.- Parameters:
label- The label to be displayed next to the radio button, 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 RadioGroupOption of(@Nonnull String label, @Nonnull String value, @Nullable String description) Creates an unchecked radio group option.- Parameters:
label- The label to be displayed next to the radio button, 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 radio button, 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 RadioGroupOption of(@Nonnull String label, @Nonnull String value, @Nullable String description, boolean isDefault) Creates a radio group option.- Parameters:
label- The label to be displayed next to the radio button, 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 radio button, 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 radio group option with the changed label.- Parameters:
label- The label for the option, up to 100 characters- Returns:
- The new radio group option instance
- Throws:
IllegalArgumentException- If the label is null, empty, or longer than 100 characters
-
withValue
Returns a copy of this radio 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 radio group option instance
- Throws:
IllegalArgumentException- If the label is null, empty, or longer than 100 characters
-
withDescription
Returns a copy of this radio 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 radio group option instance
- Throws:
IllegalArgumentException- If the provided description is longer than 100 characters
-
withDefault
Returns a copy of this radio group option with the changed default.- Parameters:
isDefault- Whether this option is selected by default- Returns:
- The new radio group option instance
-
getLabel
Returns the label displayed next to the radio button.- Returns:
- The label
-
getValue
Returns the value associated to this radio 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 RadioGroupOption 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
-