本文整理汇总了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);
}
}
}
}
示例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;
}
示例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);
}
}
示例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++;
}
}
}
}
示例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;
}
示例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
}
}
}
}