public static class MapBean {
private Map<String, Integer> data;
private String name;
private Map<String, Developer2> developers;
...
}
public static class Developer2 {
private String name;
private String role;
...
}
However I wish to accomplish something like this instead:
data:
aaa: 1
bbb: 2
zzz: 3
developers:
team1:
- name: Fred
role: creator
- name: John
role: committer
team2:
- name: John
role: committer
name: Bean123
Where each "variable" key (team1 and team2) points to a list (collection) of Developer2 types instead of only containing a single instance..
I created "MapBeanList" for this purpose:
public static class MapBeanList {
private Map<String, Integer> data;
private String name;
private Map<String, List<Developer2>> developers;
...
}
And ran this code to load it:
Yaml beanLoader = new Yaml();
MapBeanList parsed = beanLoader.loadAs(output, MapBeanList.class);
But instead of the list in team1/2 containing "Developer2" types, it contains a generic LinkedHashMap.
Is there something additional I need to do? Do I need to create a Constructor or TypeDescription? Or is this not even possible?
Thanks!