org.ho.yaml.Yaml.loadType()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.ho.yaml.Yaml.loadType()方法的一些代码示例,展示了Yaml.loadType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yaml.loadType()方法的具体详情如下:
包路径:org.ho.yaml.Yaml
类名称:Yaml
方法名:loadType

Yaml.loadType介绍

暂无

代码示例

代码示例来源:origin: mbechler/marshalsec

/**
 * {@inheritDoc}
 *
 * @see marshalsec.MarshallerBase#unmarshal(java.lang.Object)
 */
@Override
public Object unmarshal ( String data ) throws Exception {
  return Yaml.loadType(data, Object.class);
}

代码示例来源:origin: org.jvnet.hudson/selenium-grid-hub-standalone

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: org.seleniumhq.selenium.grid/selenium-grid-core

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: org.openqa.selenium.grid/selenium-grid-core

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: com.github.hackerwin7/jlib-utils

/**
   * read yaml file and return the value
   * @param fileName
   * @param key
   * @return value string
   * @throws Exception
   */
  public static String readYaml(String fileName, String key) throws Exception {
    HashMap map = Yaml.loadType(FileUtils.class.getClassLoader().getResource(fileName).openStream(), HashMap.class);
    return map.get(key).toString();
  }
}

代码示例来源:origin: com.gitee.sherlockholmnes/goge-core

/**
 * 根据文件路径 获取yml配置文件
 *
 * @param path 路径
 * @return str
 */
public static String readYml(String path) throws Exception {
  InputStream inputStream = null;
  try {
    inputStream = FileUtil.class.getResourceAsStream(path);
    HashMap testEntity = org.ho.yaml.Yaml.loadType(inputStream, HashMap.class);//如果是读入Map,这里不可以写Map接口,必须写实现
    return JSON.toJSONString(testEntity);
  } catch (Exception e) {
    logger.error("", e);
    throw e;
  } finally {
    try{
      inputStream.close();
    } catch (Exception e){
    }
  }
}

相关文章

微信公众号

最新文章

更多