Reputation: 41
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);
Upvotes: 0
Views: 66
Reputation: 1499770
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.
Upvotes: 2
Reputation: 533442
You have to give the instance whose field you want to change which is most likely c
.
Upvotes: -1