/**
* Returns the name of the parameter. If the parameter's name is
* {@linkplain #isNamePresent() present}, then this method returns
* the name provided by the class file. Otherwise, this method
* synthesizes a name of the form argN, where N is the index of
* the parameter in the descriptor of the method which declares
* the parameter.
*
* @return The name of the parameter, either provided by the class
* file or synthesized if the class file does not provide
* a name.
*/
public String getName() {
// Note: empty strings as paramete names are now outlawed.
// The .equals("") is for compatibility with current JVM
// behavior. It may be removed at some point.
if(name == null || name.equals(""))
return "arg" + index;
else
return name;
}

说明:

  • jdk1.8反射包增加了Parameter类,通过该类的getName方法能在运行时得到参数的名称
  • 如果没有通过-parameters指定编译器在编译的时候将参数名编译进去,那么得到的参数名称将会是arg1、arg2、arg3这种默认的参数名

最新文章

  1. .net 的 Url 中文加密
  2. 换个角度说工作单元(Unit Of Work):创建、持有与API调用
  3. WPF oxyPlot 使用总结
  4. IIS7 IIS7.5 配置备份
  5. 夺命雷公狗---node.js---3commonJs 与 nodeJs的简介
  6. 【JS Note】undefined与null
  7. Appium —— desired_capabilities详解
  8. Java 并发专题 : Timer的缺陷 用ScheduledExecutorService替代
  9. IO流02_文件过滤器
  10. N!末尾有多少个零
  11. Python 练习冊,每天一个小程序
  12. CF 1138F 超级有意思的一道交互题QVQ
  13. autoconf配置的项目,编译debug版本
  14. uva 331 Mapping the Swaps 求交换排序的map 纯DFS
  15. STM8S——watchdog(IWDG)
  16. Oracle 11g 错误:ORA-28002: the password will expire within 7 days 解决方法
  17. ADO.NET数据库编程
  18. 解决 SVN版本冲突
  19. 安装python包
  20. crm使用soap删除下拉框

热门文章

  1. Filebeat的使用
  2. svn 清除用户名和密码
  3. npm和yarn常用调试命令
  4. 【SpringBoot】SpringBoot日志框架(四)
  5. oracle plsql 自定义异常
  6. android文件分享在android7.0以上版本报错的解决方案
  7. Redis 分布式锁的正确实现方式(Java版)[转]
  8. C语言设计模式
  9. Guide of Apache Directory Studio
  10. laravel操作mongo详细说明