mardi 25 août 2015

Collect information of members of a Class using Reflection

I'm trying to collect information about members of a class in Java using the standard reflection API. I've been successful for the most part except for members which are java collections and nested. Something like...

class Foo {
    int bar;
    List<List<List<String>>> baz; // problematic.
}

I'm collecting all this information into a Map via recursing over nested fields.

Recurse(Foo) -> Recurse(baz) -> Recurse(List<List<String>>) -> Recurse(List<String>)...

If there is already a library to help with some of this which I might have skipped, please mention it. Much appreciated :)





Aucun commentaire:

Enregistrer un commentaire