mercredi 27 avril 2016

How to deep-copy reflection classes?

Suppose, we've got a very simple object:

import java.lang.reflect.*
class Test{
    Oject o;
    Method m;
    Field f;
    ...
    Test testObj = new Test();
}

I need to make a deep copy of testObj. Unfortunately, Object, Method and Field classes are not serializable. But is there a standart way, a workaround or any other way to make the copy have them?

I would greatly appreciate a code sample since general guiding (as in this topic) is too confusing for a newbie like me.





Aucun commentaire:

Enregistrer un commentaire