例如我的方法名称是
public static Address convert(final com.test.Address wsAddress)throws Exception
我要整条线。
如果我做
IMethod[] methods=type.getMethods();
IMethod method=methods[0];
String mname=method.toString();
mname=mname.substring(0, mname.indexOf(")")+1);
我只有
Address convert(com.test.Address)
接口IMethod
扩展了接口IMember
。此接口提供了一种称为的方法getFlags()
,您可以使用该方法查询所涉及成员的修饰符。有关更多详细信息,请参见此方法的文档。
与其他查询方法(如帮助getElementName()
,getParameterNames()
,getReturnType()
,...),你必须与它在源装配的整个方法的签名。没有办法只调用一个方法并获得整个源声明行。
编辑
如果要获取完整的方法源代码,也可以调用method getSource()
。但是,这也将提供方法的主体。所以问题应该是:您要达到什么目标?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句