Yes, agree, that java.lang.reflect, or BeanUtils would be of use.
But before I start coding, wanted to see if anybody would be willing to share
Java code to recurse through a composite bean to get all component beans as a list. Code could be as:
public static List getComponents(ComponentBean bean){
//////TO DO: implement
}
poc.ComponentBean "has a" poc.TigerBean
poc.TigerBean in turn "has a" poc.ForestBean
poc.ComponentBean extends poc.ParentBean
poc.ParentBean "has a" GuitarBean with public getter method.
As such, getComponents(myComponentBean) would return a List that would contain all the ablove beans namely:
poc.ComponentBean
poc.TigerBean
poc.ForestBean
poc.ParentBean
poc.GuitarBean
If myComponentBean did not have any member variable starting with poc, then only populate the List with single bean, which is myComponentBean.
Obiously, java.lang.reflect and/or BeanUtils from Apache could be used. I could check all the beans starting with poc and could write recursive code to populate the list.
But before I start coding it, wanted to see if anybody would be willing to share any similar code written in the past.
Any version of Java would suffice.
Regards