当前位置: 首页>>代码示例>>Java>>正文


Java MethodDeclaration.parameters方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.MethodDeclaration.parameters方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.parameters方法的具体用法?Java MethodDeclaration.parameters怎么用?Java MethodDeclaration.parameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.parameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractParametersFromSource

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
private void extractParametersFromSource(List<Variable> parametersVarList,
		IMethod javaElement) {
	Option<MethodDeclaration> mDecl = WorkspaceUtilities.getMethodDeclFromModel(javaElement);
	MethodDeclaration mmDecl = mDecl.unwrap();

	List<SingleVariableDeclaration> parameters = mmDecl.parameters();
	for (SingleVariableDeclaration param : parameters) {
		IVariableBinding paramBinding = param.resolveBinding();
		if(!paramBinding.getType().isPrimitive()){
			Variable paramVariable = this.tm.getVariableFromBindingKey(paramBinding.getKey());
			if(paramVariable!=null){
				parametersVarList.add(paramVariable);
			}
		}
	}
}
 
开发者ID:aroog,项目名称:code,代码行数:17,代码来源:PushIntoOwnedTransferFunctions.java

示例2: getMethodParameters

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
/**
 * returns the method Parameters as a list of ast.VariableDeclarataion 
 * */
public static List<ast.VariableDeclaration> getMethodParameters(MethodDeclaration md) {
	List<ast.VariableDeclaration> params = new ArrayList<ast.VariableDeclaration>();
	IMethodBinding methodBinding = md.resolveBinding();
	if(methodBinding != null ) {
		ITypeBinding[] typeParameters = methodBinding.getTypeParameters();
		List<SingleVariableDeclaration> svdList = md.parameters();
		for (SingleVariableDeclaration svd : svdList) {
			ast.Type type = getType(svd.getType().resolveBinding());
			ast.VariableDeclaration vd = VariableDeclaration.createFrom(svd);
			vd.varType = type;
			vd.varName = svd.getName().getFullyQualifiedName();
			params.add(vd);
		}
	}
	return params;
}
 
开发者ID:aroog,项目名称:code,代码行数:20,代码来源:TraceabilityFactory.java

示例3: handleMethodParams

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
private void handleMethodParams(MethodDeclaration node) {
	current.setId(node.getName().toString());
	List<?> parameters = node.parameters();
	for(int i = 0; i < parameters.size(); i++) {
		SingleVariableDeclaration var = (SingleVariableDeclaration) parameters.get(i);
		current.addVar(var.getName().getIdentifier(), i, false);
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:9,代码来源:VarParser.java

示例4: getMethodDeclarations

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
/**
 * Method that verify how many times a method is referenced
 * by another method body declaration 
 * @author Mariana Azevedo
 * @since 13/07/2014
 * @param method
 * @param firstMethodStatements
 */
private void getMethodDeclarations(MethodDeclaration method, List<Statement> firstMethodStatements) {
	for (IType ty : iTypeList){
		
		if (firstMethodStatements.toString().contains(ty.getElementName())) numCalls++;
		
		for (Object param : method.parameters()){
			if (((SingleVariableDeclaration)param).getType().toString().matches(ty.getElementName())){
				numCalls++;
			}
		}
	}
}
 
开发者ID:mariazevedo88,项目名称:o3smeasures-tool,代码行数:21,代码来源:CouplingBetweenObjectsVisitor.java

示例5: extractArguments

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
private List<ConstructorParameterSetterBuilderField> extractArguments(MethodDeclaration constructor) {
    List<ConstructorParameterSetterBuilderField> result = new ArrayList<>();
    List<SingleVariableDeclaration> parameters = constructor.parameters();
    for (int i = 0; i < parameters.size(); ++i) {
        result.add(createConstructorParameterSetterBuilderField(parameters.get(i), i));
    }
    return result;
}
 
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:9,代码来源:SuperConstructorParameterCollector.java

示例6: traverseMethodParams

import org.eclipse.jdt.core.dom.MethodDeclaration; //导入方法依赖的package包/类
private void traverseMethodParams(MethodDeclaration methodDeclaration) throws IOException {
	List parameters = methodDeclaration.parameters();
	for (Iterator itParams = parameters.iterator(); itParams.hasNext();) {
		SingleVariableDeclaration param = (SingleVariableDeclaration) itParams.next();

		ITypeBinding type = param.resolveBinding().getType();
		if (hasAnnotation(param.modifiers()) && !type.isPrimitive()) {
			SingleMemberAnnotation annotation = getAnnotation(param.modifiers());
			Expression value = annotation.getValue();
			if (value instanceof StringLiteral) { //@Domain("D")
				StringLiteral annotValue = (StringLiteral)value;
				String parserInput = annotValue.getLiteralValue();
				AnnotationInfo annotInfo = AnnotationInfo.parseAnnotation(parserInput); 
				DomainParams annot = annotInfo.getAnnotation();	
			boolean isDom = isDomain(methodDeclaration.resolveBinding().getDeclaringClass(), annot);
			boolean isDomPars = isDomainParams(methodDeclaration.resolveBinding().getDeclaringClass(), annot);
			
			ObjectMetricItem archMetricItem = new ObjectMetricItem(param.resolveBinding().getKey(),
				        param.getName().getFullyQualifiedName(),
				        param.getType().resolveBinding().getQualifiedName(),
				        parserInput,
				        methodDeclaration.resolveBinding().getDeclaringClass().getQualifiedName(),
				        param.toString(),
				        Modifier.isStatic(param.getModifiers()),
				        "MethodParams",
				        param.resolveBinding().getType().isArray(),
				        param.resolveBinding().getType().isEnum(),
				        param.resolveBinding().getType().isParameterizedType(),
				        isDom,
				        isDomPars,
				        annot.isObjectPublicDomain());
			if (!objectsHashtable.containsKey(archMetricItem.toString())) {
				objectsHashtable.put(archMetricItem.toString(), archMetricItem);
				}
				// TODO: src.triplets for Method Params
			}
		}
	}
}
 
开发者ID:aroog,项目名称:code,代码行数:40,代码来源:AnnotatMetrics.java


注:本文中的org.eclipse.jdt.core.dom.MethodDeclaration.parameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。