Class JOptCommandLinePropertySource


  • public class JOptCommandLinePropertySource
    extends CommandLinePropertySource<joptsimple.OptionSet>
    CommandLinePropertySource implementation backed by a JOpt OptionSet.

    Typical usage

    Configure and execute an OptionParser against the String[] of arguments supplied to the main method, and create a JOptCommandLinePropertySource using the resulting OptionSet object:
     public static void main(String[] args) {
         OptionParser parser = new OptionParser();
         parser.accepts("option1");
         parser.accepts("option2").withRequiredArg();
         OptionSet options = parser.parse(args);
         PropertySource ps = new JOptCommandLinePropertySource(options);
         // ...
     }
    See CommandLinePropertySource for complete general usage examples.

    Requires JOpt Simple version 4.3 or higher. Tested against JOpt up until 5.0.

    Since:
    3.1
    Author:
    Chris Beams, Juergen Hoeller, Dave Syer
    See Also:
    CommandLinePropertySource, OptionParser, OptionSet