[jboss-dev-forums] [Design the new POJO MicroContainer] - Anonymous beans

alesj do-not-reply at jboss.com
Mon Apr 7 11:01:02 EDT 2008


Brian is looking for this issue to get resolved asap (he's having a bunch of beans that don't need any name, mostly inner beans):
 - http://jira.jboss.com/jira/browse/JBMICROCONT-281
 - http://jira.jboss.com/jira/browse/JBMICROCONT-28
 - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=89581&postdays=0&postorder=asc&start=0
 - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=105759

Is there any preferred  to do metadata cloning?
I'm thinking of something like this:

  |    public Object clone()
  |    {
  |       AbstractBeanMetaData clone = new AbstractBeanMetaData();
  |       doClone(clone);
  |       return clone;
  |    }
  |    
  |    protected void doClone(AbstractBeanMetaData clone)
  |    {
  |       super.doClone(clone);
  |       clone.setBean(bean);
  |       clone.setName(name);
  |       clone.setAliases(aliases);      
  |       ...
  |    }
  | 

Do we already have some similar code, to clone collections:

  |    @SuppressWarnings("unchecked")
  |    public static <U extends JBossInterface, T extends Collection<U>> T clone(T collection)
  |    {
  |       if (collection == null)
  |          return null;
  | 
  |       try
  |       {
  |          Class<? extends Collection> collectionClass = collection.getClass();
  |          T clone = (T)collectionClass.newInstance();
  |          for (U item : collection)
  |             clone.add((U)item.clone());
  |          return clone;
  |       }
  |       catch (Throwable t)
  |       {
  |          throw new RuntimeException(t);
  |       }
  |    }
  | 

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

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



More information about the jboss-dev-forums mailing list