mercredi 19 décembre 2018

How to add annotation or any other marker to a field during runtime?

I am creating an object from another one using Java reflection API. There is an annotation defined on the Class of the source object. However it is not defined on the Class of the target object.

How do I copy the value of the annotation to the target object during runtime ? It need not be by using annotation.

I know it is not possible to dynamically add any annotation at runtime. Also, there is no possibility of using Javassist because the classes are already by the time.





Aucun commentaire:

Enregistrer un commentaire