How to create Java classes Dynamically by Java Reflection?

后端 未结 4 928
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 16:57

Reflection is used to load java class classes and manipulate them on the fly. But I have across a weird question that is asking me how to create Java classes on the fly by R

4条回答
  •  再見小時候
    2021-01-03 17:25

    You can try ASM ASM

    or Byte code engineering library

    Byte code engineering library

    for manipulating, creating classes at run time

    In .NET we have Reflection.Emit(C#) which can do that Reflection.Emit

    Not sure whether there is a direct java equivalent. You can see another similar question on SO here Java equivalent of reflection.emit

提交回复
热议问题