• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Switch类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UniqueRowsMeta类代码示例发布时间:2022-05-22
下一篇:
Java OrderByItem类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap