}
}
}
private void addResourceEnvRef(JndiConsumer annotatedApp, String resourceName, String resourceType, Method method, Field field, Resource annotation) {
ResourceEnvRef resourceEnvRef = new ResourceEnvRef();
//------------------------------------------------------------------------------
// <resource-env-ref> required elements:
//------------------------------------------------------------------------------
// resource-env-ref-name
resourceEnvRef.setResourceEnvRefName(resourceName);
if (!resourceType.isEmpty()) {
// resource-env-ref-type
resourceEnvRef.setResourceEnvRefType(resourceType);
}
if (method != null || field != null) {
// injectionTarget
resourceEnvRef.getInjectionTarget().add(configureInjectionTarget(method, field));
}
//------------------------------------------------------------------------------
// <resource-env-ref> optional elements:
//------------------------------------------------------------------------------
// description
String descriptionAnnotation = annotation.description();
if (!descriptionAnnotation.isEmpty()) {
resourceEnvRef.setDescriptions(new Text[] {new Text(null, descriptionAnnotation) } );
}
// mappedName
String mappdedNameAnnotation = annotation.mappedName();
if (!mappdedNameAnnotation.isEmpty()) {
resourceEnvRef.setMappedName(mappdedNameAnnotation);
}
// lookup
String lookup = annotation.lookup();
if (!lookup.equals("")) {
resourceEnvRef.setLookupName(lookup);
}
annotatedApp.getResourceEnvRef().add(resourceEnvRef);
}