Assume my class I have a field name called
private long _quantity;
I have created a getter and a setter for it (e.g. getQty and setQty).
Is there a way in Java reflection when I use field.set(...) to force it to go through its setter?
I just read up on a tag @Access…does any one have experience with using @Access? can it be used to force a field access into a method?
No, if you want to call your setter, you’ll need to call that method and not set the field directly.
If you have a handle on the field itself,
setwill not go through your method.