public TypeInfo getType(MetaDataVisitor visitor, MetaDataVisitorNode previous) throws Throwable
{
if (factory != null || factoryClassName != null)
{
KernelControllerContext context = visitor.getControllerContext();
ClassLoader cl = Configurator.getClassLoader(context.getBeanMetaData());
KernelConfigurator configurator = context.getKernel().getConfigurator();
ClassInfo classInfo;
if (factory != null)
{
Object target = factory.getValue(null, cl);
classInfo = configurator.getClassInfo(target.getClass());
}
else
{
classInfo = configurator.getClassInfo(factoryClassName, cl);
}
// should be parameter
if (previous instanceof ParameterMetaData == false)
throw new IllegalArgumentException("Previous node is not ParameterMetaData as expected: " + previous);
ParameterMetaData parameter = (ParameterMetaData) previous;
String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
MethodInfo methodInfo = Configurator.findMethodInfo(classInfo, factoryMethod, parameterTypes, factoryClassName != null, true);
return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
}
else
{
KernelControllerContext context = visitor.getControllerContext();
BeanInfo beanInfo = context.getBeanInfo();
// find matching parameter
if (previous instanceof ParameterMetaData)
{
ParameterMetaData parameter = (ParameterMetaData) previous;
String[] paramTypes = Configurator.getParameterTypes(false, parameters);