3 ms·
Just checked in our code base: getDeclaredFields does return private fields, you then call field.setAccessible(true) to bypass security so you can then get/set
by justinsb 17y ago
Just checked in our code base: getDeclaredFields does return private fields, you then call field.setAccessible(true) to bypass security so you can then get/set the field.
And this definitely works across packages - we use it for some evil tricks like peeking into private fields in the Java runtime library.
- jacquesm 17y agoSweet! Ok, so that solves my short term problem, longer term I'll have to put in a more solid ORM than this home built thing. At least it will cut down on the cruft enough that I can start to see the wood for the trees. thank you very much.
- jacquesm 17y agoOK, that was it, exactly. I was using getFields before, I completely missed the 'Declared' option.