I am attempting to set a field value on a class that is already compiled using a class loader. I am having trouble. I keep getting an error that looks like:
Can not set abc.ModelOne field abc.ModelTwo.modelOne to java.lang.Class
It doesn't look like its recognizing the object as its type. I even went as far as casting the object as its type but still no avail.
Object value = field.getType().cast(p);
field.set(clazz, value);
Any guidance would be awesome! Thank you.
Aucun commentaire:
Enregistrer un commentaire