메서드 매개 변수의 정규화 된 이름을 가져와야합니다. 예를 들어메서드에서 매개 변수 값의 정규화 된 이름을 얻는 방법
:
public void display(Custom1 a, Custom2 b) {
String x = a.getValue();
String y = b.getValue();
}
여기
, Custom1
및 Custom2
나는 ... 그래서 나는 내 이클립스 플러그인이 필요 해요
com.test.resource.Custom1
같은 값을 얻을 필요가 com.test.resource
에 중고 IMethod.getParameterTypes()
. 결과는 다음과 같습니다.
QCustom1;
메서드 매개 변수의 정규화 된 이름은 어떻게 얻을 수 있습니까?
String[] parameterNames = iMethod.getParameterNames();
ILocalVariable[] parameterTypes = currentmethod.getMethod().getParameters();
for (int j=0; j < parameterNames.length; ++j) {
System.out.println("parameter name:" + parameterNames[j]);
System.out.println("parameter type:" + parameterTypes[j]);
}
감사 당신은 도움을 위해 클래스를로드 한 후에이 로직을 시도했지만 작동합니다! – HilmiAziz