So for context, I am trying to make a system which gets all the fields/parameters/components of the record and stores them in a yaml file. I tried doing this but it's not writting properly since it creates the file but then it writes !!me.mrafonso.configtest.TestRecord {} instead of a properly structed yaml file.
The record class only contains a String and an integer for both name and age (for testing)
I am using snakeyaml 2.0 to try to do this but I am unsure how to continue with this.
public static void saveConfig(Record record, Path filePath) {
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setPrettyFlow(true);
Yaml yaml = new Yaml(options);
try (FileWriter writer = new FileWriter(filePath.toString())) {
yaml.dump(record, writer);
} catch (IOException e) {
throw new RuntimeException(e);
}
}