jeudi 6 septembre 2018

Order of the classes in the map

I have Hashmap which contains Key as interface and value as Class. For each key I need to create the instance i.e object using reflection. There are some @Inject tags in those class. I have to inject those objects which are already created. The problem here is from the Map I need to identify based on some oder. i.e the @injected object I need to get those classes first and created the object. So that when I iterate through map I can easily create the object and inject it. Can somehow help me here.

Example

1) interface1 , Class1 --> it has inject tag class2 (2) interface2 , Class2

Now from the has map I need to get class2 first so that I can create the object and put in another hashmap. When I iterate class1 , I see inject tag with class2. Since the class2 is already created. I can easily inject that.





Aucun commentaire:

Enregistrer un commentaire