Package com.google.googlejavaformat.java
Class JavaCommentsHelper
- java.lang.Object
-
- com.google.googlejavaformat.java.JavaCommentsHelper
-
- All Implemented Interfaces:
CommentsHelper
public final class JavaCommentsHelper extends java.lang.Object implements CommentsHelper
JavaCommentsHelperextendsCommentsHelperto rewrite Java comments.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatternLINE_COMMENT_MISSING_SPACE_PREFIXprivate java.lang.StringlineSeparatorprivate JavaFormatterOptionsoptions-
Fields inherited from interface com.google.googlejavaformat.CommentsHelper
PARAMETER_COMMENT
-
-
Constructor Summary
Constructors Constructor Description JavaCommentsHelper(java.lang.String lineSeparator, JavaFormatterOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringindentJavadoc(java.util.List<java.lang.String> lines, int column0)private java.lang.StringindentLineComments(java.util.List<java.lang.String> lines, int column0)private static booleanjavadocShaped(java.util.List<java.lang.String> lines)private java.lang.StringpreserveIndentation(java.util.List<java.lang.String> lines, int column0)java.lang.Stringrewrite(Input.Tok tok, int maxWidth, int column0)Try to rewrite comments, returning rewritten text.private java.util.List<java.lang.String>wrapLineComments(java.util.List<java.lang.String> lines, int column0)
-
-
-
Field Detail
-
lineSeparator
private final java.lang.String lineSeparator
-
options
private final JavaFormatterOptions options
-
LINE_COMMENT_MISSING_SPACE_PREFIX
private static final java.util.regex.Pattern LINE_COMMENT_MISSING_SPACE_PREFIX
-
-
Constructor Detail
-
JavaCommentsHelper
public JavaCommentsHelper(java.lang.String lineSeparator, JavaFormatterOptions options)
-
-
Method Detail
-
rewrite
public java.lang.String rewrite(Input.Tok tok, int maxWidth, int column0)
Description copied from interface:CommentsHelperTry to rewrite comments, returning rewritten text.- Specified by:
rewritein interfaceCommentsHelper- Parameters:
tok- the comment's tokmaxWidth- the line length for the outputcolumn0- the current column- Returns:
- the rewritten comment
-
preserveIndentation
private java.lang.String preserveIndentation(java.util.List<java.lang.String> lines, int column0)
-
indentLineComments
private java.lang.String indentLineComments(java.util.List<java.lang.String> lines, int column0)
-
wrapLineComments
private java.util.List<java.lang.String> wrapLineComments(java.util.List<java.lang.String> lines, int column0)
-
indentJavadoc
private java.lang.String indentJavadoc(java.util.List<java.lang.String> lines, int column0)
-
javadocShaped
private static boolean javadocShaped(java.util.List<java.lang.String> lines)
-
-