本文整理汇总了Java中org.eclipse.jdt.core.dom.CompilationUnit.getCommentList方法的典型用法代码示例。如果您正苦于以下问题:Java CompilationUnit.getCommentList方法的具体用法?Java CompilationUnit.getCommentList怎么用?Java CompilationUnit.getCommentList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.CompilationUnit
的用法示例。
在下文中一共展示了CompilationUnit.getCommentList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.jdt.core.dom.CompilationUnit; //导入方法依赖的package包/类
/**
* @see ASTVisitor#visit(CompilationUnit)
*/
@SuppressWarnings("unchecked")
@Override
public boolean visit(CompilationUnit unit) {
List<Comment> commentList = unit.getCommentList();
for (Comment comment : commentList) {
comment.delete();
}
this.numberOfLinesOfCode = (double) unit.toString().split("\n").length;
return false;
}
示例2: serializeAll
import org.eclipse.jdt.core.dom.CompilationUnit; //导入方法依赖的package包/类
private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG, SerializerProvider provider) throws IOException {
List<StructuralPropertyDescriptor> descriptorList = node.structuralPropertiesForType();
jG.writeStartObject();
final int Ntype = node.getNodeType();
String ClassName = node.nodeClassForType(Ntype).getName().substring(25);
jG.writeFieldName("internalClass");
jG.writeString(ClassName);
for (StructuralPropertyDescriptor descriptor : descriptorList) {
Object child = node.getStructuralProperty(descriptor);
if (child instanceof List) {
serializeChildList(cu, (List<ASTNode>) child, jG, descriptor, provider);
} else if (child instanceof ASTNode) {
serializeChild(cu, (ASTNode) child, jG, descriptor, provider);
} else if (child != null) {
jG.writeFieldName(descriptor.getId());
jG.writeString(child.toString());
serializePosition(cu, node, jG);
}
}
if (node == cu) {
List<Comment> cl = cu.getCommentList();
if (!cl.isEmpty()) {
jG.writeFieldName("comments");
jG.writeStartArray();
for (Comment c: (List<Comment>) cu.getCommentList()) {
if (c.getParent() != null) continue;
jG.writeStartObject();
final int type = c.getNodeType();
String name = c.nodeClassForType(type).getName().substring(25);
jG.writeFieldName("internalClass");
jG.writeString(name);
serializePosition(cu, (ASTNode)c, jG);
jG.writeEndObject();
}
jG.writeEndArray();
}
}
jG.writeEndObject();
}
示例3: getCommentList
import org.eclipse.jdt.core.dom.CompilationUnit; //导入方法依赖的package包/类
/**
* Returns list of {@link Comment}
*
* @param compilationUnit
* compilation unit to be analyzed
* @return lists of comments
*/
@SuppressWarnings("unchecked")
private List<Comment> getCommentList(final CompilationUnit compilationUnit) {
return compilationUnit.getCommentList();
}