Skip to content

Welcome to Annotation Command Line Package

ccorsi edited this page Jul 16, 2012 · 1 revision

This simple tool was created to simplify the process of sharing classes that are used to assign and process command line options throughout multiple applications and/or projects. The objective is to be able to use an annotation, (@Option), to associated methods and/or fields as candidates for command line options. The developer associates the Option annotation for every method and/or field that are command line options.

The Option annotation allows the developer to state what the name of the option. The name can define different types of standard command line options. The include, -C, -A , --foo=bar, -O2. Each of these options are defined differently within the Option annotation. The beauty is that you can define multiple ways of passing that command line option using that single Option annotation. This makes it possible to provide different ways of passing those values on the command line.

The other advantage of using the package is that you can embed multiple instances within a top-level instance that reference command line options. These options can then be made available by assigning the field or method the OptionReference annotation. This tells the tool that you want to include the options available from that class as part of this class command line options. The great thing about this is that you can create a hierarchy of command line options that can then be combined to produce a fairly rich command line options that a user can use without having to code them.

Examples will be included that show you how to use this tool.

Clone this wiki locally