Class OptionManager


  • public class OptionManager
    extends java.lang.Object
    Maintains a set of named options.
    • Constructor Summary

      Constructors 
      Constructor Description
      OptionManager​(@NotNull Settings settings)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addOption​(@NotNull java.lang.String optionName, @NotNull java.lang.String documentation, @NotNull Option option)
      Adds a new option.
      @NotNull CheckBoxOption getCheckBoxOption​(@NotNull java.lang.String optionName)
      Returns a check box option.
      void loadOptions()
      Loads all options' states from the backing settings instance.
      void removeOption​(@NotNull java.lang.String optionName)
      Removes an option by name.
      void saveOptions()
      Saves all options' states to the backing settings instance.
      • Methods inherited from class java.lang.Object

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

      • OptionManager

        public OptionManager​(@NotNull
                             @NotNull Settings settings)
        Creates a new instance.
        Parameters:
        settings - the settings instance for loading/saving option values
    • Method Detail

      • addOption

        public void addOption​(@NotNull
                              @NotNull java.lang.String optionName,
                              @NotNull
                              @NotNull java.lang.String documentation,
                              @NotNull
                              @NotNull Option option)
                       throws OptionException
        Adds a new option.
        Parameters:
        optionName - the option name to add
        documentation - the documentation string for the settings
        option - the option to add
        Throws:
        OptionException - if the option name is not unique
      • removeOption

        public void removeOption​(@NotNull
                                 @NotNull java.lang.String optionName)
        Removes an option by name. Does nothing if the option does not exist.
        Parameters:
        optionName - the option name to remove
      • getCheckBoxOption

        @NotNull
        public @NotNull CheckBoxOption getCheckBoxOption​(@NotNull
                                                         @NotNull java.lang.String optionName)
                                                  throws OptionException
        Returns a check box option.
        Parameters:
        optionName - the option name to look up
        Returns:
        the option
        Throws:
        OptionException - if the option name does not exist
      • loadOptions

        public void loadOptions()
        Loads all options' states from the backing settings instance.
      • saveOptions

        public void saveOptions()
        Saves all options' states to the backing settings instance.