Package org.apache.oodt.commons.option

Examples of org.apache.oodt.commons.option.CmdLineOption


                    curArg = curArg.substring(2);
                else
                    curArg = curArg.substring(1);

                // check if option is a valid one
                CmdLineOption curOption = CmdLineOptionUtils.getOptionByName(
                        curArg, validOptions);
                if (curOption == null)
                    throw new IOException("Invalid option '" + curArg + "'");

                // check if option has arguments
                List<String> values = new LinkedList<String>();
                if (curOption.hasArgs()) {
                    while (j + 1 < args.length && !args[j + 1].startsWith("-"))
                        values.add(args[++j]);
                    if (values.size() < 1)
                        throw new IOException("Option " + curArg
                                + " should have at least one argument");
                }

                //check if is a perform and quit option
                if (curOption.isPerformAndQuit()) {
                  curOption.getHandler().handleOption(curOption, values);
                  System.exit(0);
                }
               
                // add to list of option instances
                optionInstances
View Full Code Here


        applyBeans.add(info);

        CmdLineOptionBeanHandler handler = new CmdLineOptionBeanHandler();
        handler.setApplyToBeans(applyBeans);

        CmdLineOption option = new CmdLineOption();
        option.setHandler(handler);
        option.setHasArgs(false);
        option.setId("foo");
        option.setDescription("bar");
        option.setLongOption("foobar");
        option.setShortOption("f");
        option.setRequired(false);
        handler.handleOption(option, Collections.EMPTY_LIST);

        assertTrue(myTestBean.isFlag());
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.commons.option.CmdLineOption

Copyright © 2018 www.massapicom. 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.