程序包 cn.wzpmc.utils

类 YamlUtils


  • public class YamlUtils
    extends java.lang.Object
    Yaml工具类
    从以下版本开始:
    2024/7/30 下午11:46
    • 构造器概要

      构造器 
      构造器 说明
      YamlUtils()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static <T> T readYamlFile​(java.io.File file, java.lang.Class<T> clazz)
      读取Yaml文件并将其序列化为一个类
      static <T> void writeYamlFile​(java.io.File file, T obj)
      将一个类序列化为Yaml文件
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • YamlUtils

        public YamlUtils()
    • 方法详细资料

      • readYamlFile

        public static <T> T readYamlFile​(java.io.File file,
                                         java.lang.Class<T> clazz)
        读取Yaml文件并将其序列化为一个类
        类型参数:
        T - 序列化的类型(需要空参构造方法)
        参数:
        file - yaml文件
        clazz - 需要序列化的类
        返回:
        一个对象
      • writeYamlFile

        public static <T> void writeYamlFile​(java.io.File file,
                                             T obj)
        将一个类序列化为Yaml文件
        类型参数:
        T - 序列化的对象
        参数:
        file - yaml文件
        obj - 数据类