Class WorldFlag<T,​F extends WorldFlag<T,​F>>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected WorldFlag​(T value, @NotNull Message flagDescription)  
    • Method Summary

      Modifier and Type Method Description
      F createFlagInstance​(T value)
      Create a new instance of the flag using a provided (non-null) value.
      boolean equals​(Object o)  
      protected abstract F flagOf​(T value)  
      abstract String getExample()
      An example of a string that would parse into a valid flag value.
      Message getFlagDescription()
      Get a simple caption that describes the flag usage.
      String getName()
      Get the flag name.
      Collection<String> getTabCompletions()
      Get the tab completable values associated with the flag type, or an empty collection if tab completion isn't supported.
      T getValue()
      Get the flag value
      int hashCode()  
      abstract F merge​(T newValue)
      Merge this flag's value with another value and return an instance holding the merged value.
      abstract F parse​(@NotNull String input)
      Parse a string into a flag, and throw an exception in the case that the string does not represent a valid flag value.
      abstract String toString()
      Returns a string representation of the flag instance, that when passed through parse(String) will result in an equivalent instance of the flag.
    • Constructor Detail

      • WorldFlag

        protected WorldFlag​(@NotNull
                            T value,
                            @NotNull
                            @NotNull Message flagDescription)
    • Method Detail

      • getValue

        @NotNull
        public final T getValue()
        Get the flag value
        Returns:
        Non-nullable flag value
      • parse

        public abstract F parse​(@NotNull
                                @NotNull String input)
                         throws FlagParseException
        Parse a string into a flag, and throw an exception in the case that the string does not represent a valid flag value. This instance won't change its state, but instead an instance holding the parsed flag value will be returned.
        Parameters:
        input - String to parse.
        Returns:
        Parsed value, if valid.
        Throws:
        FlagParseException - If the value could not be parsed.
      • merge

        public abstract F merge​(@NotNull
                                T newValue)
        Merge this flag's value with another value and return an instance holding the merged value.
        Parameters:
        newValue - New flag value.
        Returns:
        Flag containing parsed flag value.
      • toString

        public abstract String toString()
        Returns a string representation of the flag instance, that when passed through parse(String) will result in an equivalent instance of the flag.
        Overrides:
        toString in class Object
        Returns:
        String representation of the flag
      • getName

        public final String getName()
        Get the flag name.
        Returns:
        Flag name
      • getFlagDescription

        public Message getFlagDescription()
        Get a simple caption that describes the flag usage.
        Returns:
        Flag description.
      • getExample

        public abstract String getExample()
        An example of a string that would parse into a valid flag value.
        Returns:
        An example flag value.
      • flagOf

        protected abstract F flagOf​(@NotNull
                                    T value)
      • createFlagInstance

        public final F createFlagInstance​(@NotNull
                                          T value)
        Create a new instance of the flag using a provided (non-null) value.
        Parameters:
        value - The flag value
        Returns:
        The created flag instance
      • getTabCompletions

        public Collection<String> getTabCompletions()
        Get the tab completable values associated with the flag type, or an empty collection if tab completion isn't supported.
        Returns:
        Collection containing tab completable flag values
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object