Class YamlCommentFormatter
java.lang.Object
org.simpleyaml.configuration.comments.format.YamlCommentFormatter
- All Implemented Interfaces:
org.simpleyaml.configuration.comments.format.CommentFormatter
- Direct Known Subclasses:
BlankLineYamlCommentFormatter,PrettyYamlCommentFormatter
public class YamlCommentFormatter
extends Object
implements org.simpleyaml.configuration.comments.format.CommentFormatter
Comment formatter to parse and dump YAML comments (using the # prefix).
Default format is YamlCommentFormat.DEFAULT.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final YamlCommentFormatterConfigurationprotected final YamlSideCommentFormatterConfiguration -
Constructor Summary
ConstructorsConstructorDescriptionYamlCommentFormatter(YamlCommentFormatterConfiguration blockFormatter) YamlCommentFormatter(YamlCommentFormatterConfiguration blockFormatter, YamlSideCommentFormatterConfiguration sideFormatter) -
Method Summary
Modifier and TypeMethodDescriptiondump(String comment, org.simpleyaml.configuration.comments.CommentType type, org.simpleyaml.configuration.comments.KeyTree.Node node) booleanformatterConfiguration(org.simpleyaml.configuration.comments.CommentType type) inthashCode()parse(Reader raw, org.simpleyaml.configuration.comments.CommentType type, org.simpleyaml.configuration.comments.KeyTree.Node node) protected StringparseCommentLine(String line, String prefix, boolean strip) stripPrefix(boolean strip) Set if stripping the prefix is desired.toString()trim(boolean trim) Set if leading and trailing spaces and blank lines at the beginning and end of the comments should be stripped away.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.simpleyaml.configuration.comments.format.CommentFormatter
dump, dump, parse, parse, parse, parse, parse
-
Field Details
-
blockFormatter
-
sideFormatter
-
-
Constructor Details
-
YamlCommentFormatter
public YamlCommentFormatter(YamlCommentFormatterConfiguration blockFormatter, YamlSideCommentFormatterConfiguration sideFormatter) -
YamlCommentFormatter
-
YamlCommentFormatter
public YamlCommentFormatter()
-
-
Method Details
-
parse
public String parse(Reader raw, org.simpleyaml.configuration.comments.CommentType type, org.simpleyaml.configuration.comments.KeyTree.Node node) throws IOException - Specified by:
parsein interfaceorg.simpleyaml.configuration.comments.format.CommentFormatter- Throws:
IOException
-
parseCommentLine
-
dump
public String dump(String comment, org.simpleyaml.configuration.comments.CommentType type, org.simpleyaml.configuration.comments.KeyTree.Node node) - Specified by:
dumpin interfaceorg.simpleyaml.configuration.comments.format.CommentFormatter
-
blockFormatter
-
sideFormatter
-
formatterConfiguration
public final YamlCommentFormatterConfiguration formatterConfiguration(org.simpleyaml.configuration.comments.CommentType type) -
stripPrefix
Set if stripping the prefix is desired.If strip is true then the comment prefix will be stripped away.
Default is true.
- Parameters:
strip- if stripping the prefix is desired- Returns:
- this object, for chaining
-
trim
Set if leading and trailing spaces and blank lines at the beginning and end of the comments should be stripped away.This does not affect to every line of a multiline comment. Only to the beginning and end of the whole comment.
Default is true.
- Parameters:
trim- ifString.trim()should be applied to comments- Returns:
- this object, for chaining
-
equals
-
hashCode
public int hashCode() -
toString
-