[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Updated Codebase

adrian@jboss.org do-not-reply at jboss.com
Sat Mar 8 07:45:13 EST 2008


"adrian at jboss.org" wrote : 
  | * Alias tests (expected)
  | 

I've fixed this so now the testsuite is back at 100% for Kernel!!! :-)

I've reworked the way aliases are parsed.
Instead of the crippled:

  | <alias class="whatever">cant do much</alias>
  | 
  |   | 
  |   | you can now do
  |   | 
  |   |   | <alias><javabean ...></alias>
  |   |   | 
  |   | 
  |   | NO POINT RE-INVENTING THE WHEEL :-)
  |   | 
  |   | Which means you can parse anything you like, 
  |   | it still seems pointless as feature to me. ;-)
  |   | 
  |   | However, to make it work, I had to put a horrible hack in the AbstractKernelControllerContext, because the aliases need to be determined
  |   | early and the basic BeanMetaData only accepts plain Objects.
  |   | 
  |   | 
  |   |   | 
  |   |   |    /**
  |   |   |     * Determine the aliases
  |   |   |     * 
  |   |   |     * @return the aliases
  |   |   |     */
  |   |   |    private static Set<Object> determineAliases(BeanMetaData metaData)
  |   |   |    {
  |   |   |       if (metaData == null)
  |   |   |          return null;
  |   |   |       
  |   |   |       // FIXME THIS IS HACK
  |   |   |       if (metaData instanceof AbstractBeanMetaData)
  |   |   |       {
  |   |   |          AbstractBeanMetaData abmd = (AbstractBeanMetaData) metaData;
  |   |   |          Set<AliasMetaData> aliasMetaDatas = abmd.getAliasMetaData();
  |   |   |          if (aliasMetaDatas != null && aliasMetaDatas.isEmpty() == false)
  |   |   |          {
  |   |   |             Set<Object> aliases = abmd.getAliases();
  |   |   |             if (aliases == null)
  |   |   |             {
  |   |   |                aliases = new HashSet<Object>();
  |   |   |                abmd.setAliases(aliases);
  |   |   |             }
  |   |   |             for (AliasMetaData aliasMetaData : aliasMetaDatas)
  |   |   |                aliases.add(aliasMetaData.getAliasValue());
  |   |   |          }
  |   |   |       }
  |   |   |       return metaData.getAliases();
  |   |   |    }
  |   |   | 
  |   | 
  |   | I'd suggest that if we are going to continue to support AliasMetaData
  |   | then BeanMetaData becomes
  |   | 
  |   |   | -   Set<Object> getAliases();
  |   |   | +   Set<AliasMetaData> getAliases();
  |   |   | 
  |   | 
  |   | Personally, I'd rather just drop it and have aliases as plain strings in the xml. ;-)

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

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



More information about the jboss-dev-forums mailing list