Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Code Generators

    Java GetOpt Generator 0.81.2

    Download button

    No screenshots available
    Downloads: 477  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.6/5)
    19 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    David Farrell | More programs
    GPL / FREE
    July 26th, 2012, 07:37 GMT
    ROOT / Programming / Code Generators

     Read user reviews (0)  Refer to a friend  Subscribe

    Java GetOpt Generator description

    Java GetOpt Generator is a software that generates a command-line argument parser from an XML file.

    Java GetOpt Generator is a software that generates a command-line argument parser from an XML file.

    Both a 'parser' and 'config' class are generated, which allows your program to either be launched from the command-line or programmatically configured and executed from another Java application.

    GetOpt Generator is Self-Hosting meaning it uses itself to generate its command-line parser.

    Configuration

    You can look at GetOpt.xml, the XML used by GetOpt to generate its own command-line parser, for an example of what the XML configuration file should look like.

    Basically each option gets:

    name

    Long name of the option. Separate logical words with "_" (i.e. long_opt)

    short

    Short (1 char) alias for the option

    type

    One of:

    · boolean
    · integer
    · string
    · input-file (verifies that file exists)
    · input-dir (verifies that dir exists)
    · output-file (treated as string for now)
    · output-dir (treated as string for now)

    Running GetOpt

    Calling GetOpt with --help generates the following output

    options for GetOpt :

    [ --help | -? ]
    ( --xmlFile | -x ) xml_file
    ( --javaDir | -j ) java_dir
    ( --exeClass | -e ) exe_class
    ( --mainClass | -m ) main_class
    ( --configClass | -c ) config_class

    NOTE: Options in brackets '[]' are optional.
    All camel-case long opts can be represented using lowercase,
    as well as with '-' or '_' seperating the camel-cased words
    (i.e. --longOpt | --longopt | --long_opt | --long-opt)

    xml_file

    The XML file containing the configuration

    main_class

    The fully qualified name (package+class) of the generated class that will parse the command line (i.e. contains the main() method).

    config_class

    The fully qualified name (package_class) of the generated class that will store the config information.

    java_dir

    The base output directory (i.e. your src directory). The generated files will be stored in /java/dir/package/path/ClassName.java

    exe_class

    The Java class that the generated command-line parser should call after parsing the command line.

    The exe class is expected to contain a constructor that accepts a config_class instance.

    The exe class is expected to contain an execute() method, which will be called by the command-line parser.

    It is the responsibility of the exe class to validate the parsed config, but the config_class is generated with a validate() function which does the heavy lifting.

    Product's homepage

      


    TAGS:

    argument parser | GetOpt generator | XML parser | Java | GetOpt | generator

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM