Is it possible in java to create 'blank' instance of class without no-arg constructor using reflection?

后端 未结 5 1229
轻奢々
轻奢々 2020-12-08 19:57

I have a class which has not default constructor. And I need a way to get \'blank\' instance of this class. \'blank\' means that after instantiation all class fields should

5条回答
  •  感情败类
    2020-12-08 20:26

    The only solution I can think of would be to use a bytecode manipulation library such as javassist to add a default constructor.

提交回复
热议问题