mercredi 29 juillet 2015

How to extract the type argument from a Java bean property?

I have an arbitrary Java bean like the following:

class SomeBean {

    public Map<String, SomeOtherBean> getOtherBeans() { ... }
    public void setOtherBeans(Map<String, SomeOtherBean> otherBeans) { ... }

}

and I would like to extract the type SomeOtherBean with a generic method. In the presence of Java's type erasure, is this even possible?





Aucun commentaire:

Enregistrer un commentaire