0

I have an interesting problem in with one of my projects. I have ZipInputeStream from uploaded zip in spring boot application with several yaml file in it, which can have any name and dynamic content which we know and have java POJO objects for them. For e.g. Below yaml corresponds to BaseModel.java

---
baseModel:
    other contents
class BaseModel{}

and below yaml will correspond to TopModel.java

---
topModel:
    other contents
class TopModel{}

Now the Question is how do i decide which java class to use for object creation at runtime based on the yaml file string. I am using jackson and tried converting yaml string to JSON but that requires a type in JSON which we dont have in the file and we cant get it added as well.

Any help on this would really be appreciated. Thanks.

0 Answers0