Hey I need change uuid value via getClass()
, here is my code but I don't know what obiect I must type instead UUID
Field uuidField = c.getClass().getDeclaredField("uuid");
uuidField.setAccessible(true);
uuidField.set(UUID, newUuidValue);
If you want the equivalent of
c.uuid = newUuidValue;
but with reflection, you just want:
uuidField.set(c, newUuidValue);
The first argument to set
is a reference to the object whose field you want to modify.
See more on this question at Stackoverflow