當前位置: 首頁>>代碼示例>>Java>>正文


Java CompilationUnit.getCommentList方法代碼示例

本文整理匯總了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;
}
 
開發者ID:mariazevedo88,項目名稱:o3smeasures-tool,代碼行數:14,代碼來源:LinesOfCodeVisitor.java

示例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();
}
 
開發者ID:bblfsh,項目名稱:java-driver,代碼行數:44,代碼來源:CompilationUnitSerializer.java

示例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();
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:12,代碼來源:CopyrightManager.java


注:本文中的org.eclipse.jdt.core.dom.CompilationUnit.getCommentList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。