我需要解析某些方法调用调用,包括一些Java类的整个签名,例如
public class MyClass {
public void myMthod() {
// ... some code here
result = someInstance.someOtherMethod(param1, param2);
// ... some other code here
}
}
Run Code Online (Sandbox Code Playgroud)
结果我想得到类似的东西:
serviceName = someInstance
methodName = someOtherMethod
arguments = {
argument = java.lang.String,
argument = boolean
}
result = java.lang.Long
Run Code Online (Sandbox Code Playgroud)
实现这一目标的最快方法是什么?我在考虑使用RegEx解析器.问题在于存在几种出现模式,例如
a)
result = someInstance.someOtherMethod(getSomething(), param);
b)
result =
getSomeInstance().someOtherMethod(param);
c)
result = getSomeInstance()
.someOtherMethod(
getSomethingElse(), null, param);
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激!谢谢!