f.getType() : resourceAn.type();
DescriptorInfo descriptorInfo = getDescriptors
(resourceType, logicalName, rcContexts);
InjectionTarget target = new InjectionTarget();
target.setFieldName(f.getName());
target.setClassName(targetClassName);
for (EnvironmentProperty desc : descriptorInfo.descriptors) {
desc.addInjectionTarget(target);
if (desc.getName().length() == 0) { // a new one
processNewAnnotation(desc, descriptorInfo.dependencyType,
descriptorInfo.resourceType,
logicalName, resourceAn);
} else if (desc.getInjectResourceType() == null) {
// if the optional resource type is not set,
// set it using the resource type of field/method
desc.setInjectResourceType(
descriptorInfo.resourceType.getName());
}
}
} else if (ElementType.METHOD.equals(ainfo.getElementType())) {
Method m = (Method)ainfo.getAnnotatedElement();
String targetClassName = m.getDeclaringClass().getName();
String logicalName = resourceAn.name();
if( logicalName.equals("") ) {
// Derive javabean property name.
String propertyName =
getInjectionMethodPropertyName(m, ainfo);
// prefixing with fully qualified type name
logicalName = targetClassName + "/" + propertyName;
}
validateInjectionMethod(m, ainfo);
Class[] params = m.getParameterTypes();
// If specified, beanInterface() overrides parameter type
// NOTE that default value is Object.class, not null
Class resourceType = (resourceAn.type() == Object.class) ?
params[0] : resourceAn.type();
DescriptorInfo descriptorInfo = getDescriptors
(resourceType, logicalName, rcContexts);
InjectionTarget target = new InjectionTarget();
target.setMethodName(m.getName());
target.setClassName(targetClassName);
for (EnvironmentProperty desc : descriptorInfo.descriptors) {
desc.addInjectionTarget(target);
if (desc.getName().length() == 0) { // a new one