use of org.jboss.as.pojo.service.BeanInfo in project wildfly by wildfly.
the class BaseBeanFactory method create.
@SuppressWarnings("unchecked")
public Object create() throws Throwable {
Module module = bmd.getModule().getInjectedModule().getValue();
Class<?> beanClass = module.getClassLoader().loadClass(bmd.getBeanClass());
DeploymentReflectionIndex index = DeploymentReflectionIndex.create();
BeanInfo beanInfo = new DefaultBeanInfo(index, beanClass);
Object result = BeanUtils.instantiateBean(bmd, beanInfo, index, module);
BeanUtils.configure(bmd, beanInfo, module, result, false);
BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getCreate(), "create");
BeanUtils.dispatchLifecycleJoinpoint(beanInfo, result, bmd.getStart(), "start");
return result;
}
use of org.jboss.as.pojo.service.BeanInfo in project wildfly by wildfly.
the class LifecycleConfig method getType.
@Override
public Class<?> getType(ConfigVisitor visitor, ConfigVisitorNode previous) {
if (previous instanceof ValueConfig == false)
throw PojoLogger.ROOT_LOGGER.notValueConfig(previous);
ValueConfig vc = (ValueConfig) previous;
BeanInfo beanInfo = visitor.getBeanInfo();
Method m = beanInfo.findMethod(methodName, Configurator.getTypes(parameters));
return m.getParameterTypes()[vc.getIndex()];
}
use of org.jboss.as.pojo.service.BeanInfo in project wildfly by wildfly.
the class ConstructorConfig method getType.
@Override
public Class<?> getType(ConfigVisitor visitor, ConfigVisitorNode previous) {
if (factory != null)
throw PojoLogger.ROOT_LOGGER.tooDynamicFromFactory();
if (previous instanceof ValueConfig == false)
throw PojoLogger.ROOT_LOGGER.notValueConfig(previous);
ValueConfig vc = (ValueConfig) previous;
if (factoryClass != null) {
if (factoryMethod == null)
throw PojoLogger.ROOT_LOGGER.nullFactoryMethod();
BeanInfo beanInfo = getTempBeanInfo(visitor, factoryClass);
Method m = beanInfo.findMethod(factoryMethod, Configurator.getTypes(parameters));
return m.getParameterTypes()[vc.getIndex()];
} else {
BeanInfo beanInfo = visitor.getBeanInfo();
if (beanInfo == null)
throw PojoLogger.ROOT_LOGGER.nullBeanInfo();
Constructor ctor = beanInfo.findConstructor(Configurator.getTypes(parameters));
return ctor.getParameterTypes()[vc.getIndex()];
}
}
Aggregations