[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Bean definition as value add problem (JBMICROCONT-28)

alesj do-not-reply at jboss.com
Thu Aug 31 06:26:30 EDT 2006


Probably a simple


  |    public List<BeanMetaData> getBeans()
  |    {
  |       List<BeanMetaData> allBeans = new ArrayList<BeanMetaData>();
  |       addBeans(this, allBeans);
  |       return allBeans;
  |    }
  | 
  |    protected void addBeans(MetaDataVisitorNode current, List<BeanMetaData> list)
  |    {
  |       for(Iterator<? extends MetaDataVisitorNode> children = current.getChildren(); children != null && children.hasNext();)
  |       {
  |          MetaDataVisitorNode next = children.next();
  |          if (next instanceof BeanMetaDataFactory)
  |          {
  |             list.addAll(((BeanMetaDataFactory) next).getBeans());
  |          }
  |          else
  |          {
  |             addBeans(next, list);
  |          }
  |       }
  |       if (current instanceof BeanMetaData)
  |       {
  |          list.add((BeanMetaData) current);
  |       }
  |    }
  | 

will do. ;-)

I also made ClassLoaderMetaData as BeanMetaDataFactory.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968589#3968589

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968589



More information about the jboss-dev-forums mailing list