当前位置: 首页>>代码示例>>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;未经允许,请勿转载。