Package ninja.leaping.configurate.loader
Enum CommentHandlers
- All Implemented Interfaces:
- Serializable,- Comparable<CommentHandlers>,- java.lang.constant.Constable,- CommentHandler
public enum CommentHandlers extends Enum<CommentHandlers> implements CommentHandler
Defines a number of default 
CommentHandlers.- 
Nested Class Summary
- 
Enum Constant SummaryEnum Constants Enum Constant Description DOUBLE_SLASHCommentHandlerfor comments prefixed by a//escape.HASHCommentHandlerfor comments prefixed by the#character.SLASH_BLOCKCommentHandlerfor comments delineated using/* *\.XML_STYLECommentHandlerfor comments delineated using<!-- -->.
- 
Method SummaryModifier and Type Method Description static @Nullable StringextractComment(@NonNull BufferedReader reader, @NonNull CommentHandler... allowedHeaderTypes)Uses provided comment handlers to extract a comment from the reader.@NonNull Optional<String>extractHeader(@NonNull BufferedReader reader)Defines the handlers behaviour for reading comments.@NonNull Collection<String>toComment(@NonNull Collection<String> lines)Converts the given lines into a commentstatic CommentHandlersvalueOf(String name)Returns the enum constant of this type with the specified name.static CommentHandlers[]values()Returns an array containing the constants of this enum type, in the order they are declared.
- 
Enum Constant Details- 
HASHCommentHandlerfor comments prefixed by the#character.
- 
DOUBLE_SLASHCommentHandlerfor comments prefixed by a//escape.
- 
SLASH_BLOCKCommentHandlerfor comments delineated using/* *\.
- 
XML_STYLECommentHandlerfor comments delineated using<!-- -->.
 
- 
- 
Method Details- 
valuesReturns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
 
- 
valueOfReturns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
- name- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
- IllegalArgumentException- if this enum type has no constant with the specified name
- NullPointerException- if the argument is null
 
- 
extractHeaderDescription copied from interface:CommentHandlerDefines the handlers behaviour for reading comments.- Specified by:
- extractHeaderin interface- CommentHandler
- Parameters:
- reader- The reader
- Returns:
- The comment
- Throws:
- IOException- If any IO error occurs in the process
 
- 
toCommentDescription copied from interface:CommentHandlerConverts the given lines into a comment- Specified by:
- toCommentin interface- CommentHandler
- Parameters:
- lines- The lines to make a comment
- Returns:
- The transformed lines
 
- 
extractCommentpublic static @Nullable String extractComment(@NonNull BufferedReader reader, @NonNull CommentHandler... allowedHeaderTypes) throws IOExceptionUses provided comment handlers to extract a comment from the reader.- Parameters:
- reader- The reader
- allowedHeaderTypes- The handlers to try
- Returns:
- The extracted comment, or null if a comment could not be extracted
- Throws:
- IOException- If an IO error occurs
 
 
-