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


Java MethodDeclaration.accept方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.dom.MethodDeclaration.accept方法的典型用法代碼示例。如果您正苦於以下問題:Java MethodDeclaration.accept方法的具體用法?Java MethodDeclaration.accept怎麽用?Java MethodDeclaration.accept使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.dom.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.accept方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visit

import org.eclipse.jdt.core.dom.MethodDeclaration; //導入方法依賴的package包/類
@Override
public boolean visit(MethodDeclaration node) {
	boolean instanceMember = !node.isConstructor() && !Modifier.isStatic(node.getModifiers());
	if(((TypeDeclaration) node.getParent()).isPackageMemberTypeDeclaration()) {
		AssignmentVisitor v = new AssignmentVisitor();
		node.accept(v);
		if(instanceMember) {
			MethodInfo m = new MethodInfo(
					node.getName().getIdentifier(), 
					VisibilityInfo.from(node), 
					node.getReturnType2().resolveBinding().isParameterizedType() ? Object.class.toString() : node.getReturnType2().resolveBinding().getQualifiedName(), 
							v.params,
							v.containsFieldAssignments);
			info.addMethod(m);
		}
	}
	return false;
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:19,代碼來源:Visitor.java

示例2: populateMethodDeclarations

import org.eclipse.jdt.core.dom.MethodDeclaration; //導入方法依賴的package包/類
private void populateMethodDeclarations(TypeDeclaration declaration){
	
	TypeDeclaration[] nestedTypes = declaration.getTypes();
	for (int i = 0; i < nestedTypes.length; i++) {
		TypeDeclaration nestedType = nestedTypes[i];
		populateMethodDeclarations(nestedType);
	}
	
	FieldDeclaration[] fields = declaration.getFields();
	for (FieldDeclaration fieldDeclaration : fields) {
		fieldDeclaration.accept(new HeuristicOwnedVisitor());
	}
	
	MethodDeclaration[] methods = declaration.getMethods();
	for (MethodDeclaration methodDeclaration : methods) {
		methodDeclaration.accept(new HeuristicOwnedVisitor());
		methodDeclaration.accept(new HeuristicOwnedLocalsVisitor());
		this.methodDecls.add(methodDeclaration);
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:21,代碼來源:RefinementAnalysis.java

示例3: countStatements

import org.eclipse.jdt.core.dom.MethodDeclaration; //導入方法依賴的package包/類
public int countStatements(MethodDeclaration methodDeclaration) {
	counter = 0;
	methodDeclaration.accept(this);
	return counter;
}
 
開發者ID:aserg-ufmg,項目名稱:RefDiff,代碼行數:6,代碼來源:AstUtils.java

示例4: parse

import org.eclipse.jdt.core.dom.MethodDeclaration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public static MethodBean parse(MethodDeclaration pMethodNode, Collection<InstanceVariableBean> pClassInstanceVariableBeans) {

    // Instantiate the bean
    MethodBean methodBean = new MethodBean();

    // Set the name
    methodBean.setName(pMethodNode.getName().toString());

    methodBean.setParameters(pMethodNode.parameters());

    methodBean.setReturnType(pMethodNode.getReturnType2());

    // Set the textual content
    methodBean.setTextContent(pMethodNode.toString());

    if ((pMethodNode.toString().contains("static "))) {
        methodBean.setStatic(true);
    } else {
        methodBean.setStatic(false);
    }

    // Get the names in the method
    Collection<String> names = new HashSet<>();
    pMethodNode.accept(new NameVisitor(names));

    // Verify the correspondence between names and instance variables 
    Collection<InstanceVariableBean> usedInstanceVariableBeans = getUsedInstanceVariable(names, pClassInstanceVariableBeans);

    // Set the used instance variables
    methodBean.setUsedInstanceVariables(usedInstanceVariableBeans);

    // Get the invocation names
    Collection<String> invocations = new HashSet<>();
    pMethodNode.accept(new InvocationVisitor(invocations));

    // Get the invocation beans from the invocation names
    Collection<MethodBean> invocationBeans = new ArrayList<>();
    for (String invocation : invocations) {
        invocationBeans.add(InvocationParser.parse(invocation));
    }

    // Set the invocations
    methodBean.setMethodCalls(invocationBeans);

    // Return the bean
    return methodBean;

}
 
開發者ID:fpalomba,項目名稱:aDoctor,代碼行數:50,代碼來源:MethodParser.java

示例5: visitLocals

import org.eclipse.jdt.core.dom.MethodDeclaration; //導入方法依賴的package包/類
private void visitLocals(TypeDeclaration declaration) {
	MethodDeclaration[] methods = declaration.getMethods();
	for (MethodDeclaration methodDeclaration : methods) {
		methodDeclaration.accept(new HeuristicOwnedLocalsVisitor());
	}
}
 
開發者ID:aroog,項目名稱:code,代碼行數:7,代碼來源:RefinementAnalysis.java


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