use of com.google.devtools.j2objc.ast.TagElement in project j2objc by google.
the class JavadocGenerator method printTagFragments.
private String printTagFragments(List<TreeNode> fragments) {
if (fragments.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
int lineNo = fragments.get(0).getLineNumber();
for (TreeNode fragment : fragments) {
if (fragment.getLineNumber() > lineNo) {
sb.append("\n ");
lineNo = fragment.getLineNumber();
}
if (fragment instanceof TextElement) {
if (spanningPreTag) {
sb.append(getSourceIndent(fragment));
}
String text = escapeDocText(((TextElement) fragment).getText());
sb.append(text);
} else if (fragment instanceof TagElement) {
sb.append(printTag((TagElement) fragment));
} else if (fragment instanceof SimpleName) {
Element element = ((Name) fragment).getElement();
if (element != null && ElementUtil.isVariable(element)) {
sb.append(NameTable.getDocCommentVariableName(((VariableElement) element)));
} else {
sb.append(fragment.toString());
}
} else {
sb.append(fragment.toString().trim());
}
}
return sb.toString();
}
Aggregations