lundi 22 avril 2019

-Design Problem--How to externalize Map of objects

I have to get few objects of classes based on the key so i created a Map like below

 Map getObjects(){
    Map objs = HashMap<String, Object>();
    objs.put("model1", new ModelOne());
    objs.put("model2", new ModelTwo());
    objs.put("model3", new ModelThree());   
 }

But how to externalized this Map of objects i.e. is there any way to I can do this dynamically using a property file/yml ? If so how ?

Can it be achieved in a functional style using java 8? if so how can it be done.

Aucun commentaire:

Enregistrer un commentaire