简体   繁体   English

从方法获取变量

[英]Getting variables from a method

我使用Java反射来获取类中使用的方法。我还想获取这些方法中使用的变量名称及其类型。我该怎么做?

You can't have their names through reflection, (but you don't really need them anyway, names are just in the source code to make it more usable through the API). 您不能通过反射来获得它们的名称(但是无论如何您实际上并不需要它们,名称只是存在于源代码中,以使其可以通过API使用)。

To get the parameters, you'll have to use getParameterTypes 要获取参数,您必须使用getParameterTypes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM