How to detect when an attribute is modified by calling reflection methods
Posted
by Oleg Pavliv
on Stack Overflow
See other posts from Stack Overflow
or by Oleg Pavliv
Published on 2010-05-12T11:49:58Z
Indexed on
2010/05/12
11:54 UTC
Read the original article
Hit count: 228
java
|reflection
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?
© Stack Overflow or respective owner