本文整理汇总了Java中org.yaml.snakeyaml.Loader类的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Loader类属于org.yaml.snakeyaml包,在下文中一共展示了Loader类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadListing
import org.yaml.snakeyaml.Loader; //导入依赖的package包/类
public ApiListing loadListing( String section ) {
Yaml yaml = new Yaml( new Loader());
//TODO: fix line above
String yamlString = readClasspathFileAsString( "/apidoc/" + section + ".yaml" );
ApiListing listing = ( ApiListing ) yaml.load( yamlString );
return listing;
}
开发者ID:apache,项目名称:usergrid,代码行数:8,代码来源:ApiDoc.java
示例2: processConfiguration
import org.yaml.snakeyaml.Loader; //导入依赖的package包/类
@Override
protected void processConfiguration(final String configuration) {
final Constructor rootConstructor = new Constructor(YamlConfiguration.class);
TypeDescription typeDescription = new TypeDescription(YamlConfiguration.class);
typeDescription.putListPropertyType("rules", YamlRule.class);
typeDescription.putMapPropertyType("properties", String.class, String.class);
typeDescription.putListPropertyType("sources", SourceDirectory.class);
typeDescription.putListPropertyType("listeners", String.class);
rootConstructor.addTypeDescription(typeDescription);
YamlConfiguration loadedConfguration = (YamlConfiguration) new Yaml(new Loader(rootConstructor)).load(configuration);
setDoCyclicDependencyTest(loadedConfguration.isDoCyclicDependencyTest());
setThrowExceptionWhenNoPackages(loadedConfguration.isThrowExceptionWhenNoPackages());
for (YamlRule rule : loadedConfguration.getRules()) {
final Rule ruleToAdd = new Rule(rule.getId());
for (String packageToAdd : rule.getPackages()) {
ruleToAdd.addPackage(packageToAdd);
}
for (String violation : rule.getViolations()) {
ruleToAdd.addViolation(violation);
}
getRules().add(ruleToAdd);
}
final Properties loadedProperties = new Properties();
loadedProperties.putAll(loadedConfguration.getProperties());
addProperties(loadedProperties);
getSources().addAll(loadedConfguration.getSources());
getIncludedListeners().addAll(loadedConfguration.getListeners());
// TODO should we support exclusion of listeners?!
}
开发者ID:AndyScherzinger,项目名称:architecturerules,代码行数:44,代码来源:YamlConfigurationFactory.java
注:本文中的org.yaml.snakeyaml.Loader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论