gpt4 book ai didi

com.argo.yaml.YamlTemplate类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 01:16:49 26 4
gpt4 key购买 nike

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

YamlTemplate介绍

[英]Created by yamingd on 9/9/15.
[中]由亚明德于2015年9月9日创作。

代码示例

代码示例来源:origin: com.github.yamingd.argo/wx-model

/**
   * 加载配置信息
   * @throws IOException 抛出文件异常
   */
  public static WxConfig load(String confName) throws IOException {
    WxConfig config = YamlTemplate.load(WxConfig.class, confName);
    return config;
  }
}

代码示例来源:origin: com.github.yamingd.argo/argo-yaml

/**
 * 加载并序列化为 T
 * @param type 目标配置类
 * @param fileName 配置文件(.yaml)
 * @param <T> 返回的目标类型
 * @return T 目标实例
 * @throws IOException 抛出IOException
 */
public static <T> T load(Class<T> type, String fileName) throws IOException {
  ClassLoader classLoader = getDefaultClassLoader();
  InputStream input = classLoader.getResourceAsStream(fileName);
  if (input == null){
    throw new IOException("File not found. fileName=" + fileName);
  }
  Yaml yaml = new Yaml();
  T o = yaml.loadAs(input, type);
  return o;
}

代码示例来源:origin: com.github.yamingd.argo/argo-yaml

/**
 * 加载并序列化为 T
 * @param fileName 配置文件(.yaml)
 * @return YamlMap
 * @throws IOException 抛出IOException
 */
public static YamlMap load(String fileName) throws IOException {
  ClassLoader classLoader = getDefaultClassLoader();
  InputStream input = classLoader.getResourceAsStream(fileName);
  if (input == null){
    throw new IOException("File not found. fileName=" + fileName);
  }
  Yaml yaml = new Yaml();
  Map o = (Map) yaml.load(input);
  return new YamlMap(o);
}

代码示例来源:origin: com.github.yamingd.argo/argo-web

/**
 * 加载配置信息
 * @throws IOException
 */
public synchronized static void load(String confName) throws IOException {
  if (instance != null){
    return;
  }
  WebConfig.instance = YamlTemplate.load(WebConfig.class, confName);
}

代码示例来源:origin: com.github.yamingd.argo/argo-security

/**
 * 加载配置信息
 * @throws IOException 文件读取异常
 */
public synchronized static void load() throws IOException {
  if (instance != null){
    return;
  }
  SecurityConfig.instance = YamlTemplate.load(SecurityConfig.class, confName);
}

代码示例来源:origin: com.github.yamingd.argo/mail-service

/**
   * 加载配置信息
   * @throws IOException
   */
  public static MailServiceConfig load(String confName) throws IOException {
    MailServiceConfig config = YamlTemplate.load(MailServiceConfig.class, confName);
    return config;
  }
}

代码示例来源:origin: com.github.yamingd.argo/argo-service

/**
 * 加载配置信息
 * @throws IOException
 */
public static RmiConfig load(String confName) throws IOException {
  RmiConfig config = YamlTemplate.load(RmiConfig.class, confName);
  return config;
}

代码示例来源:origin: com.github.yamingd.argo/argo-redis

/**
 * 加载配置信息
 * @throws IOException
 */
public synchronized static void load(String confName) throws IOException {
  if (instance != null){
    return;
  }
  if (null == confName){
    confName = defaultConfName;
  }
  RedisConfig.instance = YamlTemplate.load(RedisConfig.class, confName);
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com