On Wed, Nov 25, 2009 at 2:42 PM, Alan Ruttenberg alanruttenberg@gmail.com wrote:
On Wed, Nov 25, 2009 at 3:06 AM, Alessio Stalla alessiostalla@gmail.com wrote:
getDeclaredFields/Methods do not handle inherited members, so to do it correctly you need to recur over superclasses and interfaces. So it could go like this: if "try-harder" or some similar flag is false, look only for getFields/Methods - you'll get all the accessible members of that class, declared or inherited, but not private members. If the flag is true, use getDeclaredXXX on the full type hierarchy of your class. I have (Java) code written for this type of recursion available.
Nice. Please send :)
It occurred to me that I had already used this code inside abcl, for the inspection of Java objects. It is in JavaObject.java - look for mapcarClassHierarchy and doClassHierarchy. It's not exposed as Lisp functions and may need to be polished if used somewhere else, but it's a start.
Ale