How to detect when an attribute is modified by calling reflection methods
- by Oleg Pavliv
I have the following class
public class MyClass {
private int myAttr;
public void setAttr(int a) {
myAttr = a;
Thread.dumpStack();
}
}
That way I can detect any attempt to modify myAttr. Well, almost any. It does not work when someone modifies myAttr using Field.set() method. How can I trap Java reflection usage?