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


Java ModuleMetadata类代码示例

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


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

示例1: testMetadata

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
protected void testMetadata() {

        testWithFactory(testFactory -> {
            // must auto-load modules to ensure all tested module dependencies are present...
            BQRuntime runtime = testFactory.app().autoLoadModules().createRuntime();

            BQModuleProvider provider = matchingProvider();
            String providerName = provider.name();

            // loading metadata ensures that all annotations are properly applied...
            Optional<ModuleMetadata> moduleMetadata = runtime
                    .getInstance(ModulesMetadata.class)
                    .getModules()
                    .stream()
                    .filter(mmd -> providerName.equals(mmd.getProviderName()))
                    .findFirst();

            assertTrue("No module metadata available for provider: '" + providerName + "'", moduleMetadata.isPresent());
            moduleMetadata.get().getConfigs();
        });
    }
 
开发者ID:bootique,项目名称:bootique,代码行数:22,代码来源:BQModuleProviderChecker.java

示例2: append

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Override
public void append(Appendable out) {
    HelpAppender appender = createAppender(out);

    List<ModuleMetadata> sortedModules = modulesMetadata
            .getModules()
            .stream()
            .sorted(Comparator.comparing(ModuleMetadata::getName))
            .collect(Collectors.toList());

    printModules(appender, sortedModules);

    List<ConfigMetadataNode> sortedConfigs = sortedModules.stream()
            .map(ModuleMetadata::getConfigs)
            .flatMap(Collection::stream)
            .sorted(Comparator.comparing(MetadataNode::getName))
            .collect(Collectors.toList());

    printConfigurations(appender, sortedConfigs);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:21,代码来源:DefaultConfigHelpGenerator.java

示例3: testGenerate_Name_MultiModule_Sorting

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Test
public void testGenerate_Name_MultiModule_Sorting() {

    ModuleMetadata module0 = ModuleMetadata.builder("MB").build();
    ModuleMetadata module1 = ModuleMetadata.builder("MA").build();
    ModuleMetadata module2 = ModuleMetadata.builder("MC").build();
    ModulesMetadata modules = ModulesMetadata.builder(module0, module1, module2).build();

    assertLines(new DefaultConfigHelpGenerator(modules, 300),
            "MODULES",
            "      MA",
            "",
            "      MB",
            "",
            "      MC"
    );
}
 
开发者ID:bootique,项目名称:bootique,代码行数:18,代码来源:DefaultConfigHelpGeneratorTest.java

示例4: printModules

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
protected void printModules(HelpAppender out, Collection<ModuleMetadata> modules) {

        if (modules.isEmpty()) {
            return;
        }

        out.printSectionName("MODULES");
        modules.forEach(m -> {
            printModuleName(out, m.getName(), m.getDescription());
        });
    }
 
开发者ID:bootique,项目名称:bootique,代码行数:12,代码来源:DefaultConfigHelpGenerator.java

示例5: compileIfValid

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
static Optional<ConfigValueMetadata> compileIfValid(DeclaredVariable var, ModulesMetadata modulesMetadata) {

        for (ModuleMetadata mm : modulesMetadata.getModules()) {
            Optional<ConfigMetadataNode> cmn = mm.findConfig(var.getConfigPath());
            if (cmn.isPresent()) {
                return cmn.map(n -> compileMetadata(var, n));
            }
        }

        return Optional.empty();
    }
 
开发者ID:bootique,项目名称:bootique,代码行数:12,代码来源:DeclaredVariableMetaCompiler.java

示例6: testGenerate_Name

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Test
public void testGenerate_Name() {

    ModuleMetadata module1 = ModuleMetadata.builder("M1").build();
    ModulesMetadata modules = ModulesMetadata.builder(module1).build();

    assertLines(new DefaultConfigHelpGenerator(modules, 300),
            "MODULES",
            "      M1"
    );
}
 
开发者ID:bootique,项目名称:bootique,代码行数:12,代码来源:DefaultConfigHelpGeneratorTest.java

示例7: testGenerate_Name_MultiModule

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Test
public void testGenerate_Name_MultiModule() {

    ModuleMetadata module1 = ModuleMetadata.builder("M1").build();
    ModuleMetadata module2 = ModuleMetadata.builder("M2").build();
    ModulesMetadata modules = ModulesMetadata.builder(module1, module2).build();

    assertLines(new DefaultConfigHelpGenerator(modules, 300),
            "MODULES",
            "      M1",
            "",
            "      M2"
    );
}
 
开发者ID:bootique,项目名称:bootique,代码行数:15,代码来源:DefaultConfigHelpGeneratorTest.java

示例8: testGenerate_Name_Description

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Test
public void testGenerate_Name_Description() {

    ModuleMetadata module1 = ModuleMetadata.builder("M1").description("Module called M1").build();
    ModuleMetadata module2 = ModuleMetadata.builder("M2").build();

    ModulesMetadata modules = ModulesMetadata.builder(module1, module2).build();

    assertLines(new DefaultConfigHelpGenerator(modules, 300),
            "MODULES",
            "      M1: Module called M1",
            "",
            "      M2"
    );
}
 
开发者ID:bootique,项目名称:bootique,代码行数:16,代码来源:DefaultConfigHelpGeneratorTest.java

示例9: testGenerate_Configs

import io.bootique.meta.module.ModuleMetadata; //导入依赖的package包/类
@Test
public void testGenerate_Configs() {

    ConfigObjectMetadata m1Config = ConfigObjectMetadata
            .builder("m1root")
            .description("Root config of M1")
            .type(ConfigRoot1.class)
            .addProperty(ConfigValueMetadata.builder("p2").type(Integer.TYPE).description("Designates an integer value").build())
            .addProperty(ConfigValueMetadata.builder("p1").type(String.class).build())
            .build();

    ConfigObjectMetadata m2Config = ConfigObjectMetadata
            .builder("m2root")
            .type(ConfigRoot2.class)
            .addProperty(ConfigValueMetadata.builder("p0").type(Boolean.class).build())
            .addProperty(ConfigValueMetadata.builder("p4").type(Bootique.class).build())
            .build();

    ModuleMetadata module1 = ModuleMetadata.builder("M1").addConfig(m1Config).build();
    ModuleMetadata module2 = ModuleMetadata.builder("M2").addConfig(m2Config).build();

    ModulesMetadata modules = ModulesMetadata.builder(module1, module2).build();

    assertLines(new DefaultConfigHelpGenerator(modules, 300),
            "MODULES",
            "      M1",
            "",
            "      M2",
            "",
            "CONFIGURATION",
            "      m1root:",
            "            #",
            "            # Root config of M1",
            "            # Resolved as 'io.bootique.help.config.DefaultConfigHelpGeneratorTest$ConfigRoot1'.",
            "            #",
            "",
            "            p1: <string>",
            "            # Designates an integer value",
            "            p2: <int>",
            "",
            "      m2root:",
            "            #",
            "            # Resolved as 'io.bootique.help.config.DefaultConfigHelpGeneratorTest$ConfigRoot2'.",
            "            #",
            "",
            "            p0: <true|false>",
            "            # Resolved as 'io.bootique.Bootique'.",
            "            p4: <value>"
    );
}
 
开发者ID:bootique,项目名称:bootique,代码行数:51,代码来源:DefaultConfigHelpGeneratorTest.java


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