本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes.JAVADOC属性的典型用法代码示例。如果您正苦于以下问题:Java JavadocTokenTypes.JAVADOC属性的具体用法?Java JavadocTokenTypes.JAVADOC怎么用?Java JavadocTokenTypes.JAVADOC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes
的用法示例。
在下文中一共展示了JavadocTokenTypes.JAVADOC属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printTree
/**
* Print AST.
* @param ast the root AST node.
* @param rootPrefix prefix for the root node
* @param prefix prefix for other nodes
* @return string AST.
*/
public static String printTree(DetailNode ast, String rootPrefix, String prefix) {
final StringBuilder messageBuilder = new StringBuilder(1024);
DetailNode node = ast;
while (node != null) {
if (node.getType() == JavadocTokenTypes.JAVADOC) {
messageBuilder.append(rootPrefix);
}
else {
messageBuilder.append(prefix);
}
messageBuilder.append(getIndentation(node))
.append(JavadocUtils.getTokenName(node.getType())).append(" -> ")
.append(JavadocUtils.escapeAllControlChars(node.getText())).append(" [")
.append(node.getLineNumber()).append(':').append(node.getColumnNumber())
.append(']').append(LINE_SEPARATOR)
.append(printTree(JavadocUtils.getFirstChild(node), rootPrefix, prefix));
node = JavadocUtils.getNextSibling(node);
}
return messageBuilder.toString();
}
示例2: isEmptyLine
/**
* Determines whether or not the line is empty line.
* @param newLine NEWLINE node.
* @return true, if line is empty line.
*/
private static boolean isEmptyLine(DetailNode newLine) {
boolean result = false;
DetailNode previousSibling = JavadocUtils.getPreviousSibling(newLine);
if (previousSibling != null
&& previousSibling.getParent().getType() == JavadocTokenTypes.JAVADOC) {
if (previousSibling.getType() == JavadocTokenTypes.TEXT
&& CommonUtils.isBlank(previousSibling.getText())) {
previousSibling = JavadocUtils.getPreviousSibling(previousSibling);
}
result = previousSibling != null
&& previousSibling.getType() == JavadocTokenTypes.LEADING_ASTERISK;
}
return result;
}
示例3: testTokens
@Test
public void testTokens() {
final int[] defaultJavadocTokens = {JavadocTokenTypes.JAVADOC};
final AbstractJavadocCheck check = new AbstractJavadocCheck() {
@Override
public void visitJavadocToken(DetailNode ast) {
// no code necessary
}
@Override
public int[] getDefaultJavadocTokens() {
return defaultJavadocTokens;
}
};
Assert.assertNotNull("Default tokens should not be null", check.getDefaultTokens());
Assert.assertArrayEquals("Acceptable tokens should be equal to default",
check.getDefaultTokens(), check.getAcceptableTokens());
Assert.assertArrayEquals("Required tokens should be equal to default",
check.getDefaultTokens(), check.getRequiredTokens());
Assert.assertArrayEquals("Invalid default javadoc tokens",
defaultJavadocTokens, check.getDefaultJavadocTokens());
Assert.assertArrayEquals("Invalid acceptable javadoc tokens",
defaultJavadocTokens, check.getAcceptableJavadocTokens());
Assert.assertNotEquals("Invalid required javadoc tokens",
defaultJavadocTokens, check.getRequiredJavadocTokens());
}
示例4: testTokens
@Test
public void testTokens() {
final int[] defaultJavadocTokens = {JavadocTokenTypes.JAVADOC};
final AbstractJavadocCheck check = new AbstractJavadocCheck() {
@Override
public void visitJavadocToken(DetailNode ast) {
// no code necessary
}
@Override
public int[] getDefaultJavadocTokens() {
return defaultJavadocTokens;
}
};
Assert.assertNotNull("Default tokens should not be null", check.getDefaultTokens());
Assert.assertArrayEquals("Acceptable tokens should be equal to default",
check.getDefaultTokens(), check.getAcceptableTokens());
Assert.assertArrayEquals("Required tokens should be equal to default",
check.getDefaultTokens(), check.getRequiredTokens());
Assert.assertArrayEquals("Invalid default javadoc tokens",
defaultJavadocTokens, check.getDefaultJavadocTokens());
Assert.assertArrayEquals("Invalid acceptable javadoc tokens",
defaultJavadocTokens, check.getAcceptableJavadocTokens());
Assert.assertNotEquals("Invalid required javadoc tokens",
defaultJavadocTokens, check.getRequiredJavadocTokens());
}
示例5: getDefaultJavadocTokens
@Override
public int[] getDefaultJavadocTokens() {
return new int[] {
JavadocTokenTypes.JAVADOC,
};
}
示例6: getDefaultJavadocTokens
@Override
public int[] getDefaultJavadocTokens() {
return new int[] {JavadocTokenTypes.JAVADOC};
}