{
BeanDefinition bd = springFactory.getBeanDefinition(beanName);
Object bean = springFactory.getBean(beanName);
if (bd == null || bean == null)
{
return new ModelBeanImpl(beanName, ModelBean.POJO);
}
String lookup = null;
boolean requiresExternalSupport = false;
PropertyValue propValue = bd.getPropertyValues().getPropertyValue("lookupKey");
if (propValue != null)
{
Object value = propValue.getValue();
if (value instanceof TypedStringValue)
{
lookup = ((TypedStringValue) value).getValue();
}
else
{
lookup = (String) value;
}
}
if (bean instanceof ExternalComponentSupport)
{
requiresExternalSupport = true;
}
modelBean = new ModelBeanImpl(beanName, ModelBean.POJO, lookup, requiresExternalSupport);
modelBeanMap.put(beanName, modelBean);
}
}
else
{
modelBean = new ModelBeanImpl(beanName, ModelBean.PREFS_MAP);
}
return modelBean;
}