J-CLOPS logoTWI-JUG logo

J-CLOPS 0.8 - Java command line option processing system

J-Clops provides yet another command line option processing tool for Java. Its main feature is convention over configuration: you simply provide a so-called option context object and the system will use reflection to automatically convert the setters in the option context class to command line options. For example, if your option context class has a method

public void setLevel (int level) {
  ...
}
            
then the following command line
c:\> java MyProgram --level 3
            
will automatically result in a call of setLevel(3) on the option context object.

More detailed configuration is possible through Java 5 annotations. No extra configuration files are necessary. For example, if you would also like the --level option to be available in the short form -l, you simply write

@Option(shortName='l')
public void setLevel (int level) {
  ...
}
            
Annotations can also be used to indicate that several options are mutually exclusive, that an option can be repeated several times on the command line, that an option cannot occur on the command line together with other options, etc.

For more information, have a look at the tutorial or the API documentation.

Dependencies

  • All classes are targeted to Java 5.0.

Developers

Current development: Kris Coolsaet

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License can be found in the file LICENSE.txt provided with the source distribution of this program (see the META-INF directory in the source jar). This license can also be found on the GNU website.

The J-Clops library is Copyright 2007-2008 Universiteit Gent