Accessing inner anonymous class members

后端 未结 7 1778
灰色年华
灰色年华 2021-01-05 18:00

Is there any way other than using reflection to access the members of a anonymous inner class?

相关标签:
7条回答
  • 2021-01-05 18:31

    Mr Fooz is right, except that interfaces can only define constant members. the best way would be to add getter/setter methods to your interface and then use those to get your value. but then for each anonymous class you would have to define those methods (kind of a pain).

    0 讨论(0)
提交回复
热议问题