Class ConfigOptionParser


  • public class ConfigOptionParser
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Object> generate​(java.util.List<ConfigOption> configList, java.lang.String... args)
      Parses the configuration list and tries to create a mapping of the corresponding objects from the command line, properties or environment variables As long as the StringConverter are implemented with a null as fail and a working conversion the mapped objects are always in a correct state and castable to their representation
      static ReportGenerator.Format getFormat​(java.lang.String... args)
      Terminates with a help message if the parse is not successful
      java.lang.Object getValue​(ConfigOption co)  
      void printUsageAndExit​(java.util.List<ConfigOption> configOptions)
      Creates a help message based on the descriptions of the ConfigOption and terminates
      • Methods inherited from class java.lang.Object

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

      • ConfigOptionParser

        public ConfigOptionParser()
    • Method Detail

      • getValue

        public java.lang.Object getValue​(ConfigOption co)
        Parameters:
        co - the configuration option to search for
        Returns:
        returns a castable object
      • generate

        public java.util.Map<java.lang.String,​java.lang.Object> generate​(java.util.List<ConfigOption> configList,
                                                                               java.lang.String... args)
        Parses the configuration list and tries to create a mapping of the corresponding objects from the command line, properties or environment variables As long as the StringConverter are implemented with a null as fail and a working conversion the mapped objects are always in a correct state and castable to their representation
        Parameters:
        configList - the configuration list by which to search for the objects
        args - command line arguments
        Returns:
        returns the map of config.longName keys and corresponding castable objects
      • getFormat

        public static ReportGenerator.Format getFormat​(java.lang.String... args)
        Terminates with a help message if the parse is not successful
        Parameters:
        args - command line arguments to
        Returns:
        the format in a correct state
      • printUsageAndExit

        public void printUsageAndExit​(java.util.List<ConfigOption> configOptions)
        Creates a help message based on the descriptions of the ConfigOption and terminates
        Parameters:
        configOptions - the configuration options of the report