Is it possible to get the declaration name of an object at runtime in java?

前端 未结 4 512
遇见更好的自我
遇见更好的自我 2020-12-18 06:18

Lets say i have a a button somewhere in the code: \"JButton closeButton\". I dont know that it\'s called \"closeButton\" but that\'s what i want to find out.

At run

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 06:48

    I think you have 2 ways:

    1. use java debugging API, i.e. turn your program into a small debugger.
    2. Use byte code engineering library

提交回复
热议问题