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


Java IMethodBinding.getTypeParameters方法代碼示例

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


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

示例1: createTypeParameters

import org.eclipse.jdt.core.dom.IMethodBinding; //導入方法依賴的package包/類
private static void createTypeParameters(ImportRewrite imports, ImportRewriteContext context, AST ast, IMethodBinding binding, MethodDeclaration decl) {
	ITypeBinding[] typeParams= binding.getTypeParameters();
	List<TypeParameter> typeParameters= decl.typeParameters();
	for (int i= 0; i < typeParams.length; i++) {
		ITypeBinding curr= typeParams[i];
		TypeParameter newTypeParam= ast.newTypeParameter();
		newTypeParam.setName(ast.newSimpleName(curr.getName()));
		ITypeBinding[] typeBounds= curr.getTypeBounds();
		if (typeBounds.length != 1 || !"java.lang.Object".equals(typeBounds[0].getQualifiedName())) {//$NON-NLS-1$
			List<Type> newTypeBounds= newTypeParam.typeBounds();
			for (int k= 0; k < typeBounds.length; k++) {
				newTypeBounds.add(imports.addImport(typeBounds[k], ast, context, TypeLocation.TYPE_BOUND));
			}
		}
		typeParameters.add(newTypeParam);
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:18,代碼來源:StubUtility2.java

示例2: getMethodParameters

import org.eclipse.jdt.core.dom.IMethodBinding; //導入方法依賴的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


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