Only dump with comments if using YAMLFormat.EXTENDED

This commit is contained in:
zml2008 2012-01-26 18:16:05 -08:00
parent 71fc98ba1c
commit 49678720c6

View File

@ -75,6 +75,7 @@ public class YAMLProcessor extends YAMLNode {
/* /*
* Map from property key to comment. Comment may have multiple lines that are newline-separated. * Map from property key to comment. Comment may have multiple lines that are newline-separated.
* Comments support based on ZerothAngel's AnnotatedYAMLConfiguration * Comments support based on ZerothAngel's AnnotatedYAMLConfiguration
* Comments are only supported with YAMLFormat.EXTENDED
*/ */
private final Map<String, String> comments = new HashMap<String, String>(); private final Map<String, String> comments = new HashMap<String, String>();
@ -183,7 +184,7 @@ public boolean save() {
writer.append(header); writer.append(header);
writer.append(LINE_BREAK); writer.append(LINE_BREAK);
} }
if (comments.size() == 0) { if (comments.size() == 0 || format != YAMLFormat.EXTENDED) {
yaml.dump(root, writer); yaml.dump(root, writer);
} else { } else {
// Iterate over each root-level property and dump // Iterate over each root-level property and dump