Package org.javacord.api.interaction
Interface SlashCommandOptionChoice
-
public interface SlashCommandOptionChoiceA choice for an slash command option.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static SlashCommandOptionChoicecreate(String name, int value)Create a new option choice builder to be used with a command option builder.static SlashCommandOptionChoicecreate(String name, String value)Create a new option choice builder to be used with a command option builder.Optional<Integer>getIntValue()Gets the integer value of this choice.StringgetName()Gets the name of this choice.Optional<String>getStringValue()Gets the string value of this choice.default StringgetValueAsString()Gets the value of this choice as a string.
-
-
-
Method Detail
-
getName
String getName()
Gets the name of this choice.- Returns:
- The name of the choice.
-
getStringValue
Optional<String> getStringValue()
Gets the string value of this choice.If this option is an integer choice, the optional will be empty.
- Returns:
- The string value of this choice.
-
getIntValue
Optional<Integer> getIntValue()
Gets the integer value of this choice.If this option is an string choice, the optional will be empty.
- Returns:
- The integer value of this choice.
-
getValueAsString
default String getValueAsString()
Gets the value of this choice as a string.If the value is an integer, its string representation will be returned.
- Returns:
- The value of the choice as a string.
-
create
static SlashCommandOptionChoice create(String name, String value)
Create a new option choice builder to be used with a command option builder.- Parameters:
name- The name of the choice.value- The value of the choice.- Returns:
- The new choice builder.
-
create
static SlashCommandOptionChoice create(String name, int value)
Create a new option choice builder to be used with a command option builder.- Parameters:
name- The name of the choice.value- The value of the choice.- Returns:
- The new choice builder.
-
-