Example usage for org.apache.commons.cli CommandLine getParsedOptionValue

List of usage examples for org.apache.commons.cli CommandLine getParsedOptionValue

Introduction

In this page you can find the example usage for org.apache.commons.cli CommandLine getParsedOptionValue.

Prototype

public Object getParsedOptionValue(String opt) throws ParseException 

Source Link

Document

Return a version of this Option converted to a particular type.

Usage

From source file:org.kalaider.desktop.scheduler.runner.Runner.java

private static void stop(CommandLine parsed) throws Exception {
    Number port = (Number) parsed.getParsedOptionValue(PORT_NUMBER_OPTION);
    if (port == null)
        port = DEFAULT_PORT_NUMBER;//from www.  j ava  2  s .co m
    try (Socket socket = new Socket(InetAddress.getLocalHost(), port.intValue())) {
        socket.sendUrgentData(0);
    }
}

From source file:org.kalaider.desktop.scheduler.runner.Runner.java

private static void start(CommandLine parsed) throws Exception {
    Number port = (Number) parsed.getParsedOptionValue(PORT_NUMBER_OPTION);
    if (port == null)
        port = DEFAULT_PORT_NUMBER;//w w  w .j  a  v a  2s .c  o  m
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
        shutdown();
    }, "ShutdownHook"));
    try (ServerSocket socket = new ServerSocket(port.intValue())) {
        File configFile = (File) parsed.getParsedOptionValue(CONFIG_OPTION);
        String profileName = (String) parsed.getParsedOptionValue(PROFILE_OPTION);
        Number threadCount = (Number) parsed.getParsedOptionValue(THREAD_NUMBER_OPTION);
        runScheduler(configFile.toPath(), profileName, threadCount == null ? 2 : threadCount.intValue());
        try (Socket accepted = socket.accept()) {
            shutdown();
        }
    }
}

From source file:org.nuras.mcpha.Client.java

/**
 * //from   w w w .  j  a v  a2  s.  c o  m
 * @param args 
 * @throws org.apache.commons.cli.ParseException 
 */
public static void main(String[] args) throws ParseException {
    Option helpOption = Option.builder("h").longOpt("help").required(false).desc("shows this message").build();

    Option debugOption = Option.builder("d").longOpt("debug").required(false).desc("show debug messages")
            .build();

    Option wsurlOption = Option.builder("u").longOpt("wsurl").numberOfArgs(1).required(false).type(String.class)
            .desc("websocket url").build();

    Options options = new Options();
    options.addOption(helpOption);
    options.addOption(debugOption);
    options.addOption(wsurlOption);

    CommandLineParser parser = new DefaultParser();
    CommandLine cmdLine = parser.parse(options, args);

    if (cmdLine.hasOption("help")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("mcpha-client", options);
    } else {
        debug = cmdLine.hasOption("debug");
        String wsurl = cmdLine.hasOption("wsurl") ? ((String) cmdLine.getParsedOptionValue("/wsurl")) : "mcpha";

        //    staticFiles.externalLocation("/html5");
        staticFiles.location("/html5"); //index.html is served at localhost:4567 (default port)
        staticFiles.expireTime(600);
        webSocket(wsurl.startsWith("/") ? wsurl : "/" + wsurl, WebsocketHandler.class);
        init();
    }
}

From source file:org.ovirt.api.metamodel.tool.EnumGenerationToolJaxb.java

public void run(String[] args) throws Exception {

    CommandLine line = createCommandLineOptions(args);

    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File xjcDir = (File) line.getParsedOptionValue(XJC_OPTION);

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);/*from ww w . j a  v a  2  s .c o m*/
    modelAnalyzer.analyzeSource(modelFile);

    // Generate the enums:
    if (xjcDir != null) {
        FileUtils.forceMkdir(xjcDir);
        enumGenerator.setOutDir(xjcDir);
        enumGenerator.generate(model);
    }
}

From source file:org.ovirt.api.metamodel.tool.Tool.java

public void run(String[] args) throws Exception {
    // Create the command line options:
    Options options = new Options();

    // Options for the locations of files and directories:
    options.addOption(Option.builder().longOpt(MODEL_OPTION)
            .desc("The directory or .jar file containing the source model files.").type(File.class)
            .required(true).hasArg(true).argName("DIRECTORY|JAR").build());

    // Options for the location of the generated XML and JSON model representations:
    options.addOption(Option.builder().longOpt(XML_DESCRIPTION_OPTION)
            .desc("The location of the generated XML description of the model. If not specified then the XML "
                    + "description isn't generated.")
            .type(File.class).required(false).hasArg(true).argName("FILE").build());
    options.addOption(Option.builder().longOpt(JSON_DESCRIPTION_OPTION)
            .desc("The location of the generated JSON description of the model. If not specified then the JSON "
                    + "description isn't generated.")
            .type(File.class).required(false).hasArg(true).argName("FILE").build());

    // Options for the location of the input and output XML schemas:
    options.addOption(Option.builder().longOpt(IN_SCHEMA_OPTION).desc("The XML schema input file.")
            .type(File.class).required(false).hasArg(true).argName("FILE").build());
    options.addOption(Option.builder().longOpt(OUT_SCHEMA_OPTION).desc("The XML schema output file.")
            .type(File.class).required(false).hasArg(true).argName("FILE").build());

    // Options for the names of generated Java sources:
    options.addOption(Option.builder().longOpt(JAVA_OPTION)
            .desc("The directory where the generated Java source will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());
    options.addOption(Option.builder().longOpt(JAXRS_OPTION)
            .desc("The directory where the generated JAX-RS source will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());
    options.addOption(Option.builder().longOpt(JAXRS_PACKAGE_OPTION)
            .desc("The name of the Java package for JAX-RS interfaces.").required(false).hasArg(true)
            .argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(XJC_PACKAGE_OPTION)
            .desc("The name of the Java package for classes generated by the XJC compiler.").required(false)
            .hasArg(true).argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(TYPES_PACKAGE_OPTION)
            .desc("The name of the Java package for the generated type interfaces.").required(false)
            .hasArg(true).argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(CONTAINERS_PACKAGE_OPTION)
            .desc("The name of the Java package for the generated type containers.").required(false)
            .hasArg(true).argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(BUILDERS_PACKAGE_OPTION)
            .desc("The name of the Java package for the generated type builders.").required(false).hasArg(true)
            .argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(JSON_PACKAGE_OPTION)
            .desc("The name of the Java package for the generated JSON readers and writers.").required(false)
            .hasArg(true).argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(XML_PACKAGE_OPTION)
            .desc("The name of the Java package for the generated XML readers and writers.").required(false)
            .hasArg(true).argName("PACKAGE").build());
    options.addOption(Option.builder().longOpt(VERSION_PREFIX_OPTION)
            .desc("The version prefix to add to the generated Java class names, for example V4.")
            .required(false).hasArg(true).argName("PREFIX").build());

    // Options for the generation of documentation:
    options.addOption(Option.builder().longOpt(DOCS_OPTION)
            .desc("The directory where the generated documentation will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());
    options.addOption(Option.builder().longOpt(ADOC_ATTRIBUTE_OPTION).desc(
            "An attribute to be included in the generated AsciiDoc documentation. The value of the argument "
                    + "should be the name attribute, followed by an optional colon and the value of the attribute.")
            .required(false).hasArg(true).argName("ATTRIBUTE").build());
    options.addOption(Option.builder().longOpt(ADOC_SEPARATOR_OPTION)
            .desc("The character to use as the separator of section identifiers in the generated AsciiDoc "
                    + "documentation. If not specified the forward slash character will be used.")
            .required(false).hasArg(true).argName("SEPARATOR").build());
    options.addOption(/*w  ww . ja v a 2  s  .com*/
            Option.builder().longOpt(REPORT_OPTION).desc("The file where the documentation report be created.")
                    .type(File.class).required(false).hasArg(true).argName("FILE").build());
    options.addOption(Option.builder().longOpt(RESOURCES_OPTION)
            .desc("The directory where the resources files will be created.").type(File.class).required(false)
            .hasArg(true).argName("DIRECTORY").build());

    // Parse the command line:
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {
        line = parser.parse(options, args);
    } catch (ParseException exception) {
        System.err.println(exception.getMessage());
        HelpFormatter formatter = new HelpFormatter();
        formatter.setSyntaxPrefix("Usage: ");
        formatter.printHelp("metamodel-tool [OPTIONS]", options);
        System.exit(1);
    }

    // Extract the locations of files and directories from the command line:
    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File xmlFile = (File) line.getParsedOptionValue(XML_DESCRIPTION_OPTION);
    File jsonFile = (File) line.getParsedOptionValue(JSON_DESCRIPTION_OPTION);
    File inSchemaFile = (File) line.getParsedOptionValue(IN_SCHEMA_OPTION);
    File outSchemaFile = (File) line.getParsedOptionValue(OUT_SCHEMA_OPTION);
    File jaxrsDir = (File) line.getParsedOptionValue(JAXRS_OPTION);
    File javaDir = (File) line.getParsedOptionValue(JAVA_OPTION);
    File docsDir = (File) line.getParsedOptionValue(DOCS_OPTION);
    File reportFile = (File) line.getParsedOptionValue(REPORT_OPTION);
    File resourcesDir = (File) line.getParsedOptionValue(RESOURCES_OPTION);

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);
    modelAnalyzer.analyzeSource(modelFile);

    // Add the built-in types to the model:
    builtinTypes.addBuiltinTypes(model);

    // Extract the version prefix from the command line and copy it to the object that manages names:
    String versionPrefix = line.getOptionValue(VERSION_PREFIX_OPTION);
    if (versionPrefix != null) {
        versionedJavaNames.setVersionPrefix(versionPrefix);
    }

    // Extract the names of the Java packages from the command line and copy them to the object that manages them:
    String[] jaxrsPackages = line.getOptionValues(JAXRS_PACKAGE_OPTION);
    if (jaxrsPackages != null) {
        for (String jaxrsPackage : jaxrsPackages) {
            javaPackages.addJaxrsRule(jaxrsPackage);
        }
    }
    String xjcPackage = line.getOptionValue(XJC_PACKAGE_OPTION);
    if (xjcPackage != null) {
        javaPackages.setXjcPackageName(xjcPackage);
    }
    String typesPackage = line.getOptionValue(TYPES_PACKAGE_OPTION);
    if (typesPackage != null) {
        javaPackages.setTypesPackageName(typesPackage);
    }
    String containersPackage = line.getOptionValue(CONTAINERS_PACKAGE_OPTION);
    if (containersPackage != null) {
        javaPackages.setContainersPackageName(containersPackage);
    }
    String buildersPackage = line.getOptionValue(BUILDERS_PACKAGE_OPTION);
    if (buildersPackage != null) {
        javaPackages.setBuildersPackageName(buildersPackage);
    }
    String jsonPackage = line.getOptionValue(JSON_PACKAGE_OPTION);
    if (jsonPackage != null) {
        javaPackages.setJsonPackageName(jsonPackage);
    }
    String xmlPackage = line.getOptionValue(XML_PACKAGE_OPTION);
    if (xmlPackage != null) {
        javaPackages.setXmlPackageName(xmlPackage);
    }

    // Extract the documentation attributes:
    String[] adocAttributeArgs = line.getOptionValues(ADOC_ATTRIBUTE_OPTION);
    if (adocAttributeArgs != null) {
        for (String adocAttributeArg : adocAttributeArgs) {
            Matcher adocAttributeMatch = ADOC_ATTRIBUTE_RE.matcher(adocAttributeArg);
            if (!adocAttributeMatch.matches()) {
                throw new IllegalArgumentException("The AsciiDoc attribute \"" + adocAttributeArg
                        + "\" doesn't match regular " + "expression \"" + ADOC_ATTRIBUTE_RE.pattern() + "\".");
            }
            String adocAttributeName = adocAttributeMatch.group("name");
            String adocAttributeValue = adocAttributeMatch.group("value");
            adocConfiguration.setAttribute(adocAttributeName, adocAttributeValue);
        }
    }

    // Get the AsciiDoc section id separator:
    String adocSeparator = line.getOptionValue(ADOC_SEPARATOR_OPTION);
    if (adocSeparator != null) {
        adocConfiguration.setSeparator(adocSeparator);
    }

    // Generate the XML representation of the model:
    if (xmlFile != null) {
        File xmlDir = xmlFile.getParentFile();
        FileUtils.forceMkdir(xmlDir);
        xmlDescriptionGenerator.generate(model, xmlFile);
    }

    // Generate the JSON representation of the model:
    if (jsonFile != null) {
        File jsonDir = jsonFile.getParentFile();
        FileUtils.forceMkdir(jsonDir);
        jsonDescriptionGenerator.generate(model, jsonFile);
    }

    // Generate the XML schema:
    if (inSchemaFile != null && outSchemaFile != null) {
        schemaGenerator.setInFile(inSchemaFile);
        schemaGenerator.setOutFile(outSchemaFile);
        schemaGenerator.generate(model);
    }

    // Generate the JAX-RS source:
    if (jaxrsDir != null) {
        FileUtils.forceMkdir(jaxrsDir);
        jaxrsGenerator.setOutDir(jaxrsDir);
        jaxrsGenerator.generate(model);
        // Generate the JAX-RS helper classes):
        jaxrsHelperGenerator.setOutDir(jaxrsDir);
        jaxrsHelperGenerator.generate(model);
    }

    // Generate the Java source:
    if (javaDir != null) {
        typesGenerator.setOutDir(javaDir);
        typesGenerator.generate(model);

        // Generate JSON support classes:
        jsonSupportGenerator.setOutDir(javaDir);
        jsonSupportGenerator.generate(model);

        // Generate XML support classes:
        xmlSupportGenerator.setOutDir(javaDir);
        xmlSupportGenerator.setResourcesDir(resourcesDir);
        xmlSupportGenerator.generate(model);
    }

    // Generate the documentation:
    if (docsDir != null) {
        docGenerator.setOutDir(docsDir);
        docGenerator.generate(model);
    }
    if (reportFile != null) {
        reportGenerator.setOutFile(reportFile);
        reportGenerator.generate(model);
    }
}

From source file:org.ovirt.sdk.go.Tool.java

public void run(String[] args) throws Exception {
    // Create the command line options:
    Options options = new Options();

    // Options for the locations of files and directories:
    options.addOption(Option.builder().longOpt(MODEL_OPTION)
            .desc("The directory or .jar file containing the source model files.").type(File.class)
            .required(true).hasArg(true).argName("DIRECTORY|JAR").build());

    // Options for the location of the generated Go sources:
    options.addOption(Option.builder().longOpt(OUT_OPTION)
            .desc("The directory where the generated Go source will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());

    // Parse the command line:
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {/*  w w  w  .  ja  v a 2  s . c o m*/
        line = parser.parse(options, args);
    } catch (ParseException exception) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setSyntaxPrefix("Usage: ");
        formatter.printHelp("go-tool [OPTIONS]", options);
        System.exit(1);
    }

    // Extract the locations of files and directories from the command line:
    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File outDir = (File) line.getParsedOptionValue(OUT_OPTION);

    // Extract the version of the:
    String version = line.getOptionValue(VERSION_OPTION);

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);
    modelAnalyzer.analyzeSource(modelFile);

    // Add the built-in types:
    builtinTypes.addBuiltinTypes(model);

    // Run the generators:
    if (outDir != null) {
        FileUtils.forceMkdir(outDir);
        for (GoGenerator generator : generators) {
            generator.setOut(outDir);
            generator.generate(model);
        }
    }
}

From source file:org.ovirt.sdk.java.Tool.java

public void run(String[] args) throws Exception {
    // Create the command line options:
    Options options = new Options();

    // Options for the locations of files and directories:
    options.addOption(Option.builder().longOpt(MODEL_OPTION)
            .desc("The directory or .jar file containing the source model files.").type(File.class)
            .required(true).hasArg(true).argName("DIRECTORY|JAR").build());

    // Options for the location of the generated sources:
    options.addOption(Option.builder().longOpt(OUT_OPTION)
            .desc("The directory where the generated source will be created.").type(File.class).required(false)
            .hasArg(true).argName("DIRECTORY").build());

    // Options for the location of the generated sources:
    options.addOption(Option.builder().longOpt(RESOURCES_OPTION)
            .desc("The directory where the resources files will be created.").type(File.class).required(false)
            .hasArg(true).argName("DIRECTORY").build());

    // Parse the command line:
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {// www .  ja va 2s .  c  o  m
        line = parser.parse(options, args);
    } catch (ParseException exception) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setSyntaxPrefix("Usage: ");
        formatter.printHelp("sdk-tool [OPTIONS]", options);
        System.exit(1);
    }

    // Extract the locations of files and directories from the command line:
    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File outDir = (File) line.getParsedOptionValue(OUT_OPTION);
    File resourcesDir = (File) line.getParsedOptionValue(RESOURCES_OPTION);

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);
    modelAnalyzer.analyzeSource(modelFile);

    // Generate href attribute to Identified type:
    addHrefAttributeToIdentifiedType(model);

    // Add the built-in types:
    builtinTypes.addBuiltinTypes(model);

    // Set the names of the packages:
    javaPackages.setTypesPackageName(BASE_PACKAGE + ".types");
    javaPackages.setContainersPackageName(BASE_PACKAGE + ".internal.containers");
    javaPackages.setBuildersPackageName(BASE_PACKAGE + ".builders");
    javaPackages.setXmlPackageName(BASE_PACKAGE + ".internal.xml");

    // Run the generators:
    if (outDir != null) {
        List<JavaGenerator> generators = new ArrayList<>();
        generators.add(structsGenerator);
        generators.add(xmlSupportGenerator);
        generators.add(enumGenerator);
        generators.add(servicesGenerator);
        generators.add(servicesImplGenerator);
        FileUtils.forceMkdir(outDir);
        for (JavaGenerator generator : generators) {
            generator.setOutDir(outDir);
            generator.setResourcesDir(resourcesDir);
            generator.generate(model);
        }
    }
}

From source file:org.ovirt.sdk.python.Tool.java

public void run(String[] args) throws Exception {
    // Create the command line options:
    Options options = new Options();

    // Options for the locations of files and directories:
    options.addOption(Option.builder().longOpt(MODEL_OPTION)
            .desc("The directory or .jar file containing the source model files.").type(File.class)
            .required(true).hasArg(true).argName("DIRECTORY|JAR").build());

    // Options for the location of the generated Python sources:
    options.addOption(Option.builder().longOpt(OUT_OPTION)
            .desc("The directory where the generated Python source will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());

    // Option to specify the version number:
    options.addOption(Option.builder().longOpt(VERSION_OPTION)
            .desc("The the version number of the SDK, for example \"4.0.0.a0\".").type(File.class)
            .required(true).hasArg(true).argName("VERSION").build());

    // Parse the command line:
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {//from w  w  w .  ja v a2  s.c  o m
        line = parser.parse(options, args);
    } catch (ParseException exception) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setSyntaxPrefix("Usage: ");
        formatter.printHelp("python-tool [OPTIONS]", options);
        System.exit(1);
    }

    // Extract the locations of files and directories from the command line:
    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File outDir = (File) line.getParsedOptionValue(OUT_OPTION);

    // Extract the version number:
    String version = line.getOptionValue(VERSION_OPTION);

    // The version will usually come from the root POM of the project, where it will the "-SNAPSHOT" suffix for non
    // release versions. We need to remove that suffix.
    version = version.replaceAll("-SNAPSHOT$", "");

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);
    modelAnalyzer.analyzeSource(modelFile);

    // Add the built-in types:
    builtinTypes.addBuiltinTypes(model);

    // Configure the object used to generate names:
    pythonNames.setVersion(version);

    // Run the generators:
    if (outDir != null) {
        FileUtils.forceMkdir(outDir);
        for (PythonGenerator generator : generators) {
            generator.setOut(outDir);
            generator.generate(model);
        }
    }
}

From source file:org.ovirt.sdk.ruby.Tool.java

public void run(String[] args) throws Exception {
    // Create the command line options:
    Options options = new Options();

    // Options for the locations of files and directories:
    options.addOption(Option.builder().longOpt(MODEL_OPTION)
            .desc("The directory or .jar file containing the source model files.").type(File.class)
            .required(true).hasArg(true).argName("DIRECTORY|JAR").build());

    // Options for the location of the generated Ruby sources:
    options.addOption(Option.builder().longOpt(OUT_OPTION)
            .desc("The directory where the generated Ruby source will be created.").type(File.class)
            .required(false).hasArg(true).argName("DIRECTORY").build());

    // Option to specify the version number of the gem:
    options.addOption(Option.builder().longOpt(VERSION_OPTION)
            .desc("The the version number of the SDK, for example \"4.0.0.Alpha0\".").type(File.class)
            .required(true).hasArg(true).argName("VERSION").build());

    // Parse the command line:
    CommandLineParser parser = new DefaultParser();
    CommandLine line = null;
    try {//from  w ww  .  j  av  a  2s. c om
        line = parser.parse(options, args);
    } catch (ParseException exception) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.setSyntaxPrefix("Usage: ");
        formatter.printHelp("ruby-tool [OPTIONS]", options);
        System.exit(1);
    }

    // Extract the locations of files and directories from the command line:
    File modelFile = (File) line.getParsedOptionValue(MODEL_OPTION);
    File outDir = (File) line.getParsedOptionValue(OUT_OPTION);

    // Extract the version of the:
    String version = line.getOptionValue(VERSION_OPTION);

    // The version will usually come from the root POM of the project, where it will use upper case for suffixes
    // like "Alpha" or "Beta". In addition it will have the "-SNAPSHOT" suffix for non release versions. We need
    // to remove the "-SNAPSHOT" suffix, and convert the result to lower case, as the common practice for Ruby
    // is to use "alpha" or "beta", lower case.
    version = version.replaceAll("-SNAPSHOT$", "").toLowerCase();

    // Analyze the model files:
    Model model = new Model();
    ModelAnalyzer modelAnalyzer = new ModelAnalyzer();
    modelAnalyzer.setModel(model);
    modelAnalyzer.analyzeSource(modelFile);

    // Add the built-in types:
    builtinTypes.addBuiltinTypes(model);

    // Configure the object used to generate names:
    rubyNames.setVersion(version);

    // Run the generators:
    if (outDir != null) {
        FileUtils.forceMkdir(outDir);
        for (RubyGenerator generator : generators) {
            generator.setOut(outDir);
            generator.generate(model);
        }
    }
}

From source file:org.syphr.mythtv.apps.commander.CommanderOption.java

public Number getNumberValue(CommandLine cl) throws ParseException {
    return (Number) cl.getParsedOptionValue(getOption().getOpt());
}