本文整理了Java中org.apache.commons.configuration2.builder.fluent.Parameters.hierarchical()
方法的一些代码示例,展示了Parameters.hierarchical()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters.hierarchical()
方法的具体详情如下:
包路径:org.apache.commons.configuration2.builder.fluent.Parameters
类名称:Parameters
方法名:hierarchical
[英]Creates a new instance of a parameters object for hierarchical configurations.
[中]为分层配置创建参数对象的新实例。
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private void loadZeidonIni( InputStream iniFile )
{
if ( iniFile == null )
throw new ZeidonException( "Could not find " + iniFileName );
InputStreamReader reader = new InputStreamReader( iniFile );
try
{
DefaultExpressionEngine engine = new DefaultExpressionEngine( DefaultExpressionEngineSymbols.DEFAULT_SYMBOLS,
NodeNameMatchers.EQUALS_IGNORE_CASE );
Parameters params = new Parameters();
FileBasedConfigurationBuilder<INIConfiguration> builder =
new FileBasedConfigurationBuilder<INIConfiguration>( INIConfiguration.class )
.configure( params.hierarchical().setExpressionEngine( engine ) );
iniConfObj = builder.getConfiguration();
iniConfObj.read( reader );
reader.close();
sectionNameMap = new HashMap<>();
for ( String sectionName : iniConfObj.getSections() )
sectionNameMap.put( sectionName.toLowerCase(), sectionName );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e ).prependFilename( iniFileName );
}
finally
{
IOUtils.closeQuietly( reader );
}
}
代码示例来源:origin: com.goldmansachs.obevo/obevo-core
private HierarchicalConfiguration<ImmutableNode> loadPropertiesFromUrl(FileObject file) {
try {
return new FileBasedConfigurationBuilder<>(FixedYAMLConfiguration.class)
.configure(new Parameters().hierarchical().setURL(file.getURLDa()))
.getConfiguration();
} catch (ConfigurationException e) {
throw new DeployerRuntimeException(e);
}
}
代码示例来源:origin: goldmansachs/obevo
private HierarchicalConfiguration<ImmutableNode> loadPropertiesFromUrl(FileObject file) {
try {
return new FileBasedConfigurationBuilder<>(FixedYAMLConfiguration.class)
.configure(new Parameters().hierarchical().setURL(file.getURLDa()))
.getConfiguration();
} catch (ConfigurationException e) {
throw new DeployerRuntimeException(e);
}
}
代码示例来源:origin: de.julielab/jssf-commons
public ExternalToolService() throws ConfigurationException {
ClasspathResource resource = new ClasspathResource(ExternalToolConstants.EXTERNAL_TOOL_VERSIONS_FILE);
Parameters params = new Parameters();
FileBasedConfigurationBuilder<JSONConfiguration> configBuilder =
new FileBasedConfigurationBuilder<>(JSONConfiguration.class).configure(params.hierarchical()
.setLocationStrategy(new ClasspathLocationStrategy())
.setFileName(ExternalToolConstants.EXTERNAL_TOOL_VERSIONS_FILE));
externalToolsConfiguration = configBuilder.getConfiguration();
}
代码示例来源:origin: goldmansachs/obevo
@Test
public void yamlTest() throws Exception {
ImmutableHierarchicalConfiguration configuration = new FileBasedConfigurationBuilder<>(FixedYAMLConfiguration.class)
.configure(new Parameters().hierarchical()
.setFile(new File("./src/test/resources/DbEnvironmentXmlEnricher/system-config.yaml"))
// .setFile(new File("./src/test/resources/DbEnvironmentXmlEnricher/system-config.xml"))
).getConfiguration();
System.out.println(configuration);
}
代码示例来源:origin: goldmansachs/obevo
@Test
public void convert() throws Exception {
XMLConfiguration configuration = new FileBasedConfigurationBuilder<>(XMLConfiguration.class)
.configure(new Parameters().hierarchical()
.setFile(new File("./src/test/resources/DbEnvironmentXmlEnricher/system-config.xml"))
).getConfiguration();
Map<String, Object> myMap = constructMap(configuration.getNodeModel().getNodeHandler().getRootNode());
FixedYAMLConfiguration yamlConfiguration = new FixedYAMLConfiguration(configuration);
StringWriter sw = new StringWriter();
// yamlConfiguration.write();
DumperOptions dumperOptions = new DumperOptions();
// dumperOptions.setPrettyFlow(true);
dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK);
Yaml yaml = new Yaml(dumperOptions);
yaml.dump(myMap, sw);
// yamlConfiguration.dump(sw, new DumperOptions());
System.out.println(sw.toString());
}
代码示例来源:origin: com.goldmansachs.obevo/obevo-core
.configure(new Parameters().hierarchical()
.setURL(envFileToRead.getURLDa())
.setListDelimiterHandler(new DisabledListDelimiterHandler())
} else {
return new FileBasedConfigurationBuilder<>(FixedYAMLConfiguration.class)
.configure(new Parameters().hierarchical()
.setURL(envFileToRead.getURLDa())
.setListDelimiterHandler(new DisabledListDelimiterHandler())
代码示例来源:origin: goldmansachs/obevo
.configure(new Parameters().hierarchical()
.setURL(envFileToRead.getURLDa())
.setListDelimiterHandler(new DisabledListDelimiterHandler())
} else {
return new FileBasedConfigurationBuilder<>(FixedYAMLConfiguration.class)
.configure(new Parameters().hierarchical()
.setURL(envFileToRead.getURLDa())
.setListDelimiterHandler(new DisabledListDelimiterHandler())
内容来源于网络,如有侵权,请联系作者删除!