Class CommentMode
java.lang.Object
space.arim.dazzleconf.ext.snakeyaml.CommentMode
Determines the way in which comments will be written
-
Method Summary
Modifier and TypeMethodDescriptionstatic CommentModeA mode which will use an alternative yaml writer (other than snakeyaml) to write both the comments of the configuration as well as the entries themselves.static CommentModealternativeWriter(String commentFormat) A mode which will use an alternative yaml writer (other than snakeyaml) to write both the comments of the configuration as well as the entries themselves.booleanWhether this comment mode is the same as anotherstatic CommentModeA mode which has full support for comments, taking advantage of functionality introduced in snakeyaml 1.28.inthashCode()static CommentModeA mode which will write the comment header on the top level configuration, but which is unable to write any further comments.booleanWhether this comment mode fully comments, including the comment header as well as comments on individual entriestoString()
-
Method Details
-
supportsComments
public boolean supportsComments()Whether this comment mode fully comments, including the comment header as well as comments on individual entries- Returns:
- whether this mode fully supports comments
-
equals
Whether this comment mode is the same as another -
hashCode
public int hashCode() -
toString
-
headerOnly
A mode which will write the comment header on the top level configuration, but which is unable to write any further comments.
This is the default mode, because it is most compatible with old versions of snakeyaml, and is highly stable.- Returns:
- a comment mode which writes the top comment header only
-
alternativeWriter
A mode which will use an alternative yaml writer (other than snakeyaml) to write both the comments of the configuration as well as the entries themselves.
This implies full comment support, but note that the alternative yaml writer, while tested and workable, does not have the same level of stability as snakeyaml itself.
The Comment Format
The comment format is used for writing comments. It must be aString.formatcompatible format string.
By default, comments are formatted as in the example: ' # Comment here'. This corresponds to the comment format" # %s"
Note well: it is caller's responsibility to ensure the comment format results in valid YAML.- Parameters:
commentFormat- the comment format with which to write comments- Returns:
- a comment mode using the alternative yaml writer
- Throws:
IllegalFormatException- if the comment format is an illegal format string
-
alternativeWriter
A mode which will use an alternative yaml writer (other than snakeyaml) to write both the comments of the configuration as well as the entries themselves.
This implies full comment support, but note that the alternative yaml writer, while tested and workable, does not have the same level of stability as snakeyaml itself.
Uses the default comment format, i.e. ' # Comment here'- Returns:
- a comment mode using the alternative yaml writer
-
fullComments
A mode which has full support for comments, taking advantage of functionality introduced in snakeyaml 1.28. If the version of snakeyaml in use is less than version 1.28, this option will fail at runtime (an undefined exception will be thrown at a later time)- Returns:
- a mode which fully supports comments using snakeyaml 1.28 or a later version
-