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


Java IMethod.getParameterTypes方法代碼示例

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


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

示例1: getMethodTypes

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private Set<IPath> getMethodTypes(final IType typeElement, final List<IImport> imports, final Path path)
    throws JavaModelException {
  final IMethod[] methods = typeElement.getMethods();
  final Set<IPath> methodTypes = new HashSet<>();
  for (final IMethod method : methods) {
    final String returnType = method.getReturnType();
    addToPaths(imports, path, methodTypes, returnType);
    final String[] parameterTypes = method.getParameterTypes();
    for (final String parameterType : parameterTypes) {
      addToPaths(imports, path, methodTypes, parameterType);
    }
    final String[] exceptionTypes = method.getExceptionTypes();
    for (final String exceptionType : exceptionTypes) {
      addToPaths(imports, path, methodTypes, exceptionType);
    }
  }
  return methodTypes;
}
 
開發者ID:AndreasWBartels,項目名稱:libraries,代碼行數:19,代碼來源:WorkspaceDependenciesInvestigator.java

示例2: sameParameters

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private static boolean sameParameters(IMethodBinding method, IMethod candidate) throws JavaModelException {
	ITypeBinding[] methodParamters= method.getParameterTypes();
	String[] candidateParameters= candidate.getParameterTypes();
	if (methodParamters.length != candidateParameters.length) {
		return false;
	}
	IType scope= candidate.getDeclaringType();
	for (int i= 0; i < methodParamters.length; i++) {
		ITypeBinding methodParameter= methodParamters[i];
		String candidateParameter= candidateParameters[i];
		if (!sameParameter(methodParameter, candidateParameter, scope)) {
			return false;
		}
	}
	return true;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:17,代碼來源:Bindings.java

示例3: getParameterTypeNamesForSeeTag

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private static String[] getParameterTypeNamesForSeeTag(IMethod overridden) {
	try {
		ASTParser parser = ASTParser.newParser(IASTSharedValues.SHARED_AST_LEVEL);
		parser.setProject(overridden.getJavaProject());
		IBinding[] bindings = parser.createBindings(new IJavaElement[] { overridden }, null);
		if (bindings.length == 1 && bindings[0] instanceof IMethodBinding) {
			return getParameterTypeNamesForSeeTag((IMethodBinding) bindings[0]);
		}
	} catch (IllegalStateException e) {
		// method does not exist
	}
	// fall back code. Not good for generic methods!
	String[] paramTypes = overridden.getParameterTypes();
	String[] paramTypeNames = new String[paramTypes.length];
	for (int i = 0; i < paramTypes.length; i++) {
		paramTypeNames[i] = Signature.toString(Signature.getTypeErasure(paramTypes[i]));
	}
	return paramTypeNames;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:20,代碼來源:StubUtility.java

示例4: createDefaultPlaceHolder

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
public String createDefaultPlaceHolder(IMethod iMethod, String className) throws JavaModelException {
	StringBuffer buffer = new StringBuffer();
	buffer.append(className + Constants.DOT);
	buffer.append(iMethod.getElementName()+ Constants.OPENING_BRACKET);
	if (iMethod.getParameterNames() != null && iMethod.getParameterNames() != null)
		for (int index = 0; index < iMethod.getParameterNames().length; index++) {
			buffer.append(iMethod.getParameterNames()[index]);
			if (index != iMethod.getParameterTypes().length - 1) {
				buffer.append(Constants.COMMA + SWT.SPACE);
			}
		}
	buffer.append(Constants.CLOSING_BRACKET);
	return StringUtils.trim(buffer.toString());
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:MethodDetails.java

示例5: getResolvedSignature

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private static String getResolvedSignature(IType type, IMethod method) throws JavaModelException {
	String sig = "(";
	for (String p : method.getParameterTypes()) {
		sig += resolve(p, type);
	}
	sig += ")" + resolve(method.getReturnType(), type);
	return sig;
	
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:10,代碼來源:LaunchCommand.java

示例6: StaticInvocationWidget

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
public StaticInvocationWidget(Composite parent, InvokeDialog invokeDialog, IMethod method, InvocationAction action) {
	super(parent, SWT.NONE);
	this.invokeDialog = invokeDialog;
	
	this.method = method;

	setLayout(rowLayout);

	methodName = method.getElementName();
	parameterTypes = method.getParameterTypes();
	Label label = new Label(this, SWT.NONE);
	FontManager.setFont(label, PandionJConstants.VAR_FONT_SIZE);
	label.setText(method.getElementName() + " (");
	paramBoxes = new Combo[method.getNumberOfParameters()];
	String[] parameterNames = null;
	try {
		parameterNames = method.getParameterNames();
	} catch (JavaModelException e1) {
		e1.printStackTrace();
	}
	for(int i = 0; i < parameterTypes.length; i++) {
		if(i != 0) {
			Label comma = new Label(this, SWT.NONE);
			FontManager.setFont(comma, PandionJConstants.VAR_FONT_SIZE);
			comma.setText(", ");
		}
		paramBoxes[i] = createCombo(invokeDialog, parameterNames[i], parameterTypes[i]);
	}
	Label close = new Label(this, SWT.NONE);
	FontManager.setFont(close, PandionJConstants.VAR_FONT_SIZE);
	close.setText(")");

	addCacheValues(paramBoxes);
	checkValidity();
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:36,代碼來源:StaticInvocationWidget.java

示例7: getParameters

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
protected List<String> getParameters(IMethod method) throws JavaModelException {
	List<String> parameters = new ArrayList<>(method.getNumberOfParameters());
	for (String parameterType : method.getParameterTypes()) {
		parameters.add(getFullyQualifiedName(method.getDeclaringType(), parameterType));
	}
	return parameters;
}
 
開發者ID:CenterDevice,項目名稱:ClassCleaner,代碼行數:8,代碼來源:JavaElementConverter.java

示例8: getParameters

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
/**
 * Extracts the resolved binary parameters from the given method
 *
 * @param method
 *          method to resolve
 * @return binary parameter specification
 */
public static String getParameters(final IMethod method)
    throws JavaModelException {
  if (method.isBinary()) {
    return getParameters(method.getSignature());
  }
  final StringBuilder buffer = new StringBuilder();
  final String[] parameterTypes = method.getParameterTypes();
  for (final String t : parameterTypes) {
    resolveArrayParameterType(method, t, buffer);
  }
  return buffer.toString();
}
 
開發者ID:eclipse,項目名稱:eclemma,代碼行數:20,代碼來源:SignatureResolver.java

示例9: getSootMethodSignature

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
/***** SootMethod signatures *****/

	public static String getSootMethodSignature(IMethod iMethod) {
		try {
			StringBuilder name = new StringBuilder();
			name.append("<");
			name.append(iMethod.getDeclaringType().getFullyQualifiedName());
			name.append(": ");
			String retTypeName = resolveName(iMethod, iMethod.getReturnType());
			if (retTypeName == null)
				return null;
			name.append(retTypeName);
			name.append(" ");
			if (iMethod.isConstructor())
				name.append("<init>");
			else
				name.append(iMethod.getElementName());
			name.append("(");

			String comma = "";
			String[] parameterTypes = iMethod.getParameterTypes();
			for (int i = 0; i < iMethod.getParameterTypes().length; ++i) {
				name.append(comma);
				String readableName = resolveName(iMethod, parameterTypes[i]);
				if (readableName == null)
					return null;
				name.append(readableName);
				comma = ",";
			}

			name.append(")");
			name.append(">");

			return name.toString();
		} catch (JavaModelException e) {
			LOGGER.error("Error building Soot method signature", e);
			return null;
		}
	}
 
開發者ID:secure-software-engineering,項目名稱:cheetah,代碼行數:40,代碼來源:PrepareAnalysis.java

示例10: createParamCountKey

import org.eclipse.jdt.core.IMethod; //導入方法依賴的package包/類
private String createParamCountKey(final IMethod method) {
  return method.getElementName() + "@" + method.getParameterTypes().length; //$NON-NLS-1$
}
 
開發者ID:eclipse,項目名稱:eclemma,代碼行數:4,代碼來源:MethodLocator.java


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