Examples of CommandLineOptions


Examples of org.exolab.castor.util.CommandLineOptions

    /**
     * Command line method
    **/
    public static void main( String[] args )
    {
        CommandLineOptions allOptions = new CommandLineOptions();

        //-- Input classname flag
        allOptions.addFlag("i", "classname", "Sets the input class");

        //-- Output filename flag
        String desc = "Sets the output mapping filename";
        allOptions.addFlag("o", "filename", desc, true);

        //-- Force flag
        desc = "Force overwriting of files.";
        allOptions.addFlag("f", "", desc, true);

        //-- Help flag
        desc = "Displays this help screen.";
        allOptions.addFlag("h", "", desc, true);

    //-- Process the specified command line options
        Properties options = allOptions.getOptions(args);

        //-- check for help option
        if (options.getProperty("h") != null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printHelp(pw);
            pw.flush();
            return;
        }

        String  classname       = options.getProperty("i");
        String  mappingName     = options.getProperty("o");
        boolean force           = (options.getProperty("f") != null);
       
       
        if (classname == null) {
            PrintWriter pw = new PrintWriter(System.out, true);
            allOptions.printUsage(pw);
            pw.flush();
            return;
        }
       
        MappingTool tool;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.