xjs.comments.CommentStyle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xjs-core Show documentation
Show all versions of xjs-core Show documentation
Core data layer and serlializers for XJS, an elegant JSON superset.
package xjs.comments;
import xjs.core.JsonValue;
/**
* This class represents the various comment styles that can be used when adding
* new comments to a {@link JsonValue}.
*/
public enum CommentStyle {
/**
* Hash style comments, indicated by placing a #
symbol at the
* start of the comment, followed by the beginning of each new line.
*
* For example,
*
*
{@code
*
* # Hash comment
* key: value
*
* }
*/
HASH("#", false),
/**
* The C style line comment, indicated by placing a //
at the
* start of the comment, followed by the beginning of each new line.
*
* For example,
*
*
{@code
*
* // Line comment
* key: value
*
* }
*/
LINE("//", false),
/**
* A block style comment, indicated by placing a /*
at the
* start of the comment, followed by a * /
(with no spaces) at
* the very end of the comment.
*
* For example,
*
*
{@code
*
* /*
* Block comment
* * /
* key: value
*
* }
*/
BLOCK("/*", true),
/**
* A variant of {@link #LINE} written with a third slash (/
) at
* the beginning of the comment.
*
* For example,
*
*
{@code
*
* /// Line document
* key: value
*
* }
*/
LINE_DOC("///", false),
/**
* A variant of {@link #BLOCK} written with a second asterisk (*
)
* at the beginning of the comment.
*
* For example,
*
*
{@code
*
* /**
* * Multiline document
* * /
* key: value
*
* }
*/
MULTILINE_DOC("/**", true);
private final String prefix;
private final boolean multiline;
CommentStyle(final String prefix, final boolean multiline) {
this.prefix = prefix;
this.multiline = multiline;
}
public String getPrefix() {
return this.prefix;
}
public boolean isMultiline() {
return this.multiline;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy