当前位置: 首页>>代码示例>>Java>>正文


Java Switch类代码示例

本文整理汇总了Java中org.dishevelled.commandline.Switch的典型用法代码示例。如果您正苦于以下问题:Java Switch类的具体用法?Java Switch怎么用?Java Switch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Switch类属于org.dishevelled.commandline包,在下文中一共展示了Switch类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAboutArgument

import org.dishevelled.commandline.Switch; //导入依赖的package包/类
protected static Switch createAboutArgument() {
    return new Switch("a", "about", "display about message");
}
 
开发者ID:nmdp-bioinformatics,项目名称:service-epitope,代码行数:4,代码来源:AbstractEpitopeTool.java

示例2: createHelpArgument

import org.dishevelled.commandline.Switch; //导入依赖的package包/类
protected static Switch createHelpArgument() {
    return new Switch("h", "help", "display help message");
}
 
开发者ID:nmdp-bioinformatics,项目名称:service-epitope,代码行数:4,代码来源:AbstractEpitopeTool.java

示例3: init

import org.dishevelled.commandline.Switch; //导入依赖的package包/类
/**
 * Create and return an injector configured using the specified command line arguments.
 *
 * @param commandName command name, used in usage string
 * @param args command line arguments
 * @return an injector configured using the specified command line arguments
 */
protected static final Injector init(final String commandName, final String[] args) {
    String usage = commandName + USAGE_PARAMS;
    Switch about = new Switch("a", "about", "display about message");
    Switch help = new Switch("h", "help", "display help message");
    final StringArgument namespace = new StringArgument("s", "namespace", "namespace", true);
    final FileArgument glstringFile = new FileArgument("g", "glstrings", "glstring input file", false);
    final FileArgument identifierFile = new FileArgument("i", "identifiers", "identifier output file", false);
    final StringArgument client = new StringArgument("c", "client", "client implementation, json or xml, default json", false);

    ArgumentList arguments = new ArgumentList(about, help, namespace, glstringFile, identifierFile, client);
    CommandLine commandLine = new CommandLine(args);
    try
    {
        CommandLineParser.parse(commandLine, arguments);
        if (about.wasFound()) {
            About.about(System.out);
            System.exit(0);
        }
        if (help.wasFound()) {
            Usage.usage(usage, null, commandLine, arguments, System.out);
            System.exit(0);
        }
    }
    catch (CommandLineParseException e) {
        if (about.wasFound()) {
            About.about(System.out);
            System.exit(0);
        }
        if (help.wasFound()) {
            Usage.usage(usage, null, commandLine, arguments, System.out);
            System.exit(0);
        }
        Usage.usage(usage, e, commandLine, arguments, System.err);
        System.exit(-1);
    }

    return Guice.createInjector(new CacheGlClientModule(), new AbstractModule() {
        @Override
        protected void configure() {
            bind(String.class).annotatedWith(Namespace.class).toInstance(namespace.getValue());

            if (glstringFile.wasFound()) {
                bind(File.class).annotatedWith(GlstringFile.class).toInstance(glstringFile.getValue());
            }
            else {
                bind(File.class).annotatedWith(GlstringFile.class).toProvider(Providers.of((File) null));
            }

            if (identifierFile.wasFound()) {
                bind(File.class).annotatedWith(IdentifierFile.class).toInstance(identifierFile.getValue());
            }
            else {
                bind(File.class).annotatedWith(IdentifierFile.class).toProvider(Providers.of((File) null));
            }

            bind(HttpClient.class).to(RestAssuredHttpClient.class);

            if ("xml".equals(client.getValue("json"))) {
                bind(GlClient.class).to(XmlGlClient.class);
            }
            else {
                bind(GlClient.class).to(JsonGlClient.class);
            }
        }
    });
}
 
开发者ID:nmdp-bioinformatics,项目名称:genotype-list,代码行数:74,代码来源:AbstractRegisterTask.java


注:本文中的org.dishevelled.commandline.Switch类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。