{
String name = factory.name();
if (name == null)
throw new IllegalArgumentException("Null bean name: " + factory);
GenericBeanFactoryMetaData gbfmd = new GenericBeanFactoryMetaData(name, clazz.getName());
Class<?> factoryClass = factory.getFactoryClass();
if (void.class.equals(factoryClass) == false)
gbfmd.setFactoryClass(factoryClass.getName());
String[] aliases = factory.aliases();
if (aliases != null && aliases.length > 0)
{
Set<AliasMetaData> aliasesMD = new HashSet<AliasMetaData>();
for (String alias : aliases)
{
AbstractAliasMetaData aamd = new AbstractAliasMetaData();
aamd.setAlias(alias);
aliasesMD.add(aamd);
}
gbfmd.setAliases(aliasesMD);
}
gbfmd.setMode(factory.mode());
gbfmd.setAccessMode(factory.accessMode());
return gbfmd.getBeanMetaData();
}