Java Reflection
I just wrote a library that (de-)serializes command objects after transmitting over network. Before executing, i’d like to (re-)inject members annotated with Guices @Inject annotation. I did some Reflection before, but never felt the needed to get hold of private fields, which is now essential.
It’s not a big deal, but in case anyone could use this snippet:
// instead of c.getFields(), use: Field[] fields = c.getDeclaredFields(); AccessibleObject.setAccessible(fields, true );
where c ist the class of the Object you want to access. Then you can iterate over and see, if the field has the annotation in question. Simple, yes – but i had to search for it, so you don’t have to.

