Class OptionUtils


  • public class OptionUtils
    extends java.lang.Object
    Utility class for providing convenience methods for working with Option's.
    • Constructor Summary

      Constructors 
      Constructor Description
      OptionUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean containsOption​(java.lang.String optionName, java.util.List<Option> options)
      Checks to see whether or not the given list of options contains the given option name.
      static boolean getBooleanOptionValue​(java.lang.String optionName, java.util.List<Option> options, boolean defaultValue)
      Gets the boolean value of the option with the given name from the given list of options.
      static <T> T getOption​(java.lang.String optionName, java.util.List<Option> options, T defaultValue)
      Gets the value of the option with the given name from the given list of options.
      • Methods inherited from class java.lang.Object

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

      • OptionUtils

        public OptionUtils()
    • Method Detail

      • containsOption

        public static boolean containsOption​(java.lang.String optionName,
                                             java.util.List<Option> options)
        Checks to see whether or not the given list of options contains the given option name.
        Parameters:
        optionName - The name of the option to check.
        options - A list of the all the options.
        Returns:
        True if the given list contains the given option; otherwise, false.
      • getOption

        public static <T> T getOption​(java.lang.String optionName,
                                      java.util.List<Option> options,
                                      T defaultValue)
        Gets the value of the option with the given name from the given list of options.
        Parameters:
        optionName - The name of the option to get.
        options - The list of options to get the option from.
        defaultValue - A default option value to use if the option name was not found.
        Returns:
        The value of the option with the given name, or the default value if it was not found.
      • getBooleanOptionValue

        public static boolean getBooleanOptionValue​(java.lang.String optionName,
                                                    java.util.List<Option> options,
                                                    boolean defaultValue)
        Gets the boolean value of the option with the given name from the given list of options.
        Parameters:
        optionName - The name of the boolean option to get.
        options - The list of options to get the option from.
        defaultValue - A default option value to use if the option name was not found.
        Returns:
        The boolean value of the option with the given name, or the default value if it was not found as a boolean option.