本文整理了Java中com.ea.orbit.actors.core.shaded.org.yaml.snakeyaml.Yaml
类的一些代码示例,展示了Yaml
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yaml
类的具体详情如下:
包路径:com.ea.orbit.actors.core.shaded.org.yaml.snakeyaml.Yaml
类名称:Yaml
暂无
代码示例来源:origin: com.ea.orbit/orbit-hk2
private static Map<String, Object> readProperties(final Set<String> activeProfiles, final InputStream in) throws IOException
{
String inputStreamString = IOUtils.toString(new InputStreamReader(in, "UTF-8"));
Yaml yaml = new Yaml();
final Iterable<Object> iter = yaml.loadAll(substituteVariables(inputStreamString));
final Map<String, Object> newProperties = new LinkedHashMap<>();
iter.forEach(item -> {
final Map<String, Object> section = (Map<String, Object>) item;
final Object sectionProfile = section.get("orbit.profile");
if (sectionProfile == null || activeProfiles.contains(sectionProfile))
{
// if no profile or if the profile is in the current list of profiles.
newProperties.putAll(section);
}
});
return newProperties;
}
代码示例来源:origin: com.ea.orbit/orbit-core
private void loadClassInfo(final ClassPath.ResourceInfo r)
{
final URL url = r.url();
try
{
final LinkedHashMap map = new Yaml().loadAs(url.openStream(), LinkedHashMap.class);
final Object classId = map.get("classId");
if (classId instanceof Number)
{
final String resourceName = r.getResourceName();
final Integer classIdKey = ((Number) classId).intValue();
final String className = resourceName.substring(META_INF_SERVICES_ORBIT_CLASSES.length(),
resourceName.length() - SUFFIX.length());
idToName.putIfAbsent(classIdKey, className);
nameToId.putIfAbsent(className, classIdKey);
}
else
{
logger.warn("classId not found at: " + url);
}
}
catch (Exception ex)
{
logger.error("Error loading class info " + url, ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!