本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.DetailNode.getText方法的典型用法代码示例。如果您正苦于以下问题:Java DetailNode.getText方法的具体用法?Java DetailNode.getText怎么用?Java DetailNode.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.puppycrawl.tools.checkstyle.api.DetailNode
的用法示例。
在下文中一共展示了DetailNode.getText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFirstSentence
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Finds and returns first sentence.
* @param ast Javadoc root node.
* @return first sentence.
*/
private static String getFirstSentence(DetailNode ast) {
final StringBuilder result = new StringBuilder(256);
final String periodSuffix = PERIOD + ' ';
for (DetailNode child : ast.getChildren()) {
final String text;
if (child.getChildren().length == 0) {
text = child.getText();
}
else {
text = getFirstSentence(child);
}
if (child.getType() != JavadocTokenTypes.JAVADOC_INLINE_TAG
&& text.contains(periodSuffix)) {
result.append(text.substring(0, text.indexOf(periodSuffix) + 1));
break;
}
else {
result.append(text);
}
}
return result.toString();
}
示例2: visitJavadocToken
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
@Override
public void visitJavadocToken(DetailNode ast) {
if (!isInlineDescription(ast)) {
final List<DetailNode> textNodes = getAllNewlineNodes(ast);
for (DetailNode newlineNode : textNodes) {
final DetailNode textNode = JavadocUtils.getNextSibling(JavadocUtils
.getNextSibling(newlineNode));
if (textNode != null && textNode.getType() == JavadocTokenTypes.TEXT) {
final String text = textNode.getText();
if (!CommonUtils.isBlank(text.trim())
&& (text.length() <= offset
|| !text.substring(1, offset + 1).trim().isEmpty())) {
log(textNode.getLineNumber(), MSG_KEY, offset);
}
}
}
}
}
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:JavadocTagContinuationIndentationCheck.java
示例3: getValueAtDetailNode
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Gets a value for DetailNode object.
* @param node DetailNode(Javadoc) node.
* @param column column index.
* @return value at specified column.
*/
private static Object getValueAtDetailNode(DetailNode node, int column) {
final Object value;
switch (column) {
case 0:
// first column is tree model. no value needed
value = null;
break;
case 1:
value = JavadocUtils.getTokenName(node.getType());
break;
case 2:
value = node.getLineNumber();
break;
case 3:
value = node.getColumnNumber();
break;
case 4:
value = node.getText();
break;
default:
throw new IllegalStateException(UNKNOWN_COLUMN_MSG);
}
return value;
}