本文整理汇总了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();
});
}
示例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);
}
示例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"
);
}
示例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());
});
}
示例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();
}
示例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"
);
}
示例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"
);
}
示例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"
);
}
示例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>"
);
}