BeanMetaData bmd = context.getBeanMetaData();
Set<RelatedClassMetaData> related = bmd.getRelated();
if (related == null || related.size() != 1)
throw new IllegalArgumentException("Invalid information for contextual injection: " + bmd);
// TODO - perhaps match which related metadata is the right one
RelatedClassMetaData beanClassMetaData = related.iterator().next();
KernelConfigurator configurator = context.getKernel().getConfigurator();
BeanInfo beanInfo = configurator.getBeanInfo(beanClassMetaData.getClassName(), context.getClassLoader());
PropertyInfo pi = beanInfo.getProperty(valueInfo.name);
TypeInfo typeInfo = pi.getType();
if (typeInfo.isCollection() || typeInfo.isMap())
{
throw new IllegalArgumentException("Cannot handle collection or map: " + valueInfo);