Java reflection: How do I override or generate methods at runtime?

后端 未结 5 1109
难免孤独
难免孤独 2020-12-05 03:08

It is possible in plain Java to override a method of a class programmatically at runtime (or even create a new method)?

I want to be able to do this even if I

5条回答
  •  -上瘾入骨i
    2020-12-05 03:41

    In java6 has been added the possibility to transform any already loaded class. Take a look at the changes in the java.lang.instrument package

提交回复
热议问题