mercredi 18 février 2015

How to use reflection to extract all properties of a certain type?

I have a number of classes which can include one or more properties of the type TranslatableText. Also, some classes may have properties which themselves include such properties such as List<TranslatableText> or Map<String, TranslatableText>.


How would you go about scanning these classes in an efficient way, also picking up instances of TranslatableText in generic collections?



class Project{
String id;
TranslatableText name;
List<Action> actions;
}

class Action {
String id;
TranslatableText name;
TranslatableText description;
}

// getter & setters omitted





Aucun commentaire:

Enregistrer un commentaire