<dependency>
<groupId>org.jyaml</groupId>
<artifactId>jyaml</artifactId>
<version>1.3</version>
</dependency>
File file = FileUtil.getFile("lxt.yml");
Map map = Yaml.loadType(file, HashMap.class);
Optional.ofNullable((Map) map.get("lxt"))
.map(lxtMap -> lxtMap.get("enums")).ifPresent(
enums -> {
for (Map<String, String> en : (List<Map<String, String>>) enums) {
String enumClass = en.get("class");
}
System.out.println();
}
);
Map lxtMap = (Map) map.get("lxt");
List<Map<String, String>> enums = (List<Map<String, String>>) lxtMap.get("enums");
for (Map<String, String> en : enums) {
en.get("");
}
System.out.println(lxtMap.get("enums"));
lxt:
enums:
- class: GenderEnum
instance:
- enumName: DISAN
fields:
- name: code
value: SAN
class: String
- name: name
value: 第三性别
class: String
- enumName: DISAN1
fields:
- name: code
value: SAN1
class: String
- name: name
value: 第三性别1
class: String
- class: FuncEnum
instance:
- enumName: H
fields:
- name: code
value: a
- name: msg
value: 厕所
- name: tableHead
value: sb
type: