Class Choice


  • public class Choice
    extends java.lang.Object
    A helper data class that stores data for creating a SlashCommandOptionChoice
    • Constructor Summary

      Constructors 
      Constructor Description
      Choice​(java.lang.String key, java.lang.Object value)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.javacord.api.interaction.SlashCommandOptionChoice getChoice()
      Constructs the SlashCommandOptionChoice instance
      java.lang.String getKey()  
      java.lang.Object getValue()  
      java.lang.Long getValueAsLong()  
      java.lang.String getValueAsString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Choice

        public Choice​(java.lang.String key,
                      java.lang.Object value)
        Default constructor
        Parameters:
        key - the choice's key (the user will see this)
        value - the choice's value can be String or Number NOTE: Discord accepts only Long type, therefore Number.longValue() is used That means, decimals are not supported!
    • Method Detail

      • getKey

        public java.lang.String getKey()
      • getValue

        public java.lang.Object getValue()
      • getValueAsString

        public java.lang.String getValueAsString()
      • getValueAsLong

        public java.lang.Long getValueAsLong()
      • getChoice

        public org.javacord.api.interaction.SlashCommandOptionChoice getChoice()
        Constructs the SlashCommandOptionChoice instance
        Returns:
        the SlashCommandOptionChoice