Interface CommentFormatter
public interface CommentFormatter
Converts a comment between a raw-format meant to be read by computers
to a human-format meant to be read by humans and vice versa.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Stringdefault Stringdump(String comment, CommentType type) dump(String comment, CommentType type, KeyTree.Node node) Given a comment returns the raw-formatted string to be dumped somewhere like a file.static Stringformat(int indent, String prefixFirst, String prefixMultiline, String comment, CommentType type, String suffixMultiline, String suffixLast) static Stringformat(int indent, String comment, CommentType type, CommentFormatterConfiguration configuration) static Stringformat(String prefixFirst, String prefixMultiline, String comment, String suffixMultiline, String suffixLast) default Stringdefault Stringparse(Reader raw, CommentType type) parse(Reader raw, CommentType type, KeyTree.Node node) Parse the comment from a reader that may contain a raw-formatted comment (for instance from a configuration file) to a human-friendly contentful representation of that comment.default Stringdefault Stringparse(String raw, CommentType type) default Stringparse(String raw, CommentType type, KeyTree.Node node) Parse the comment from a string that may contain a raw-formatted comment (for instance from a configuration file) to a human-friendly contentful representation of that comment.
-
Method Details
-
parse
Parse the comment from a reader that may contain a raw-formatted comment (for instance from a configuration file) to a human-friendly contentful representation of that comment.- Parameters:
raw- the comment to parse that may contain special format characters with leading and trailing spacetype- the comment typenode- the comment node- Returns:
- the comment in the expected format to be read by humans
- Throws:
IOException- if comment cannot be parsed
-
dump
Given a comment returns the raw-formatted string to be dumped somewhere like a file.- Parameters:
comment- the comment to be dumpedtype- the comment typenode- the comment node- Returns:
- the raw-formatted comment string to be dumped, for instance to a configuration file
-
parse
Parse the comment from a string that may contain a raw-formatted comment (for instance from a configuration file) to a human-friendly contentful representation of that comment.- Parameters:
raw- the comment to parse that may contain special format characters with leading and trailing spacetype- the comment typenode- the comment node- Returns:
- the comment in the expected format to be read by humans
- Throws:
IOException
-
parse
- Throws:
IOException
-
parse
- Throws:
IOException
-
parse
- Throws:
IOException
-
parse
- Throws:
IOException
-
dump
-
dump
-
format
-
format
-
format
static String format(int indent, String comment, CommentType type, CommentFormatterConfiguration configuration)
-