/** * Finds and returns chars till first dot. * * @param textNode node with javadoc text. * @return String with chars till first dot. */ private static String getCharsTillDot(DetailNode textNode) { final StringBuilder result = new StringBuilder(); for (DetailNode child : textNode.getChildren()) { result.append(child.getText()); if (PERIOD.equals(child.getText()) && JavadocUtils.getNextSibling(child).getType() == JavadocTokenTypes.WS) { break; } } return result.toString(); }
/** * Finds and returns first sentence. * * @param ast Javadoc root node. * @return first sentence. */ private static String getFirstSentence(DetailNode ast) { final StringBuilder result = new StringBuilder(); final String periodSuffix = PERIOD + ' '; for (DetailNode child : ast.getChildren()) { if (child.getType() != JavadocTokenTypes.JAVADOC_INLINE_TAG && child.getText().contains(periodSuffix)) { result.append(getCharsTillDot(child)); break; } else { result.append(child.getText()); } } return result.toString(); }
@Override public void visitJavadocToken(DetailNode ast) { if (isEmptyTag(ast.getParent())) { log(ast.getLineNumber(), MSG_KEY, ast.getText()); } }