propertyName = getPropertyName((Method) injectionPoint.getMember()); if (propertyName == null) { throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) injectionPoint.getMember());
@Override public Object resolveResource(InjectionPoint injectionPoint) { final Member member = injectionPoint.getMember(); AnnotatedMember<?> annotatedMember; if (injectionPoint.getAnnotated() instanceof AnnotatedField) { annotatedMember = (AnnotatedField<?>) injectionPoint.getAnnotated(); } else { annotatedMember = ((AnnotatedParameter<?>) injectionPoint.getAnnotated()).getDeclaringCallable(); } if (!annotatedMember.isAnnotationPresent(Resource.class)) { throw WeldLogger.ROOT_LOGGER.annotationNotFound(Resource.class, member); } if (member instanceof Method && ((Method) member).getParameterTypes().length != 1) { throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) member); } String name = getResourceName(injectionPoint); for (ResourceInjectionResolver resolver : resourceResolvers) { Object result = resolver.resolve(name); if (result != null) { return result; } } try { return context.lookup(name); } catch (NamingException e) { throw WeldLogger.ROOT_LOGGER.couldNotFindResource(name, injectionPoint.getMember().toString(), e); } }
propertyName = getPropertyName((Method) injectionPoint.getMember()); if (propertyName == null) { throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) injectionPoint.getMember());
private String getEjbBindLocation(InjectionPoint injectionPoint) { EJB ejb = ResourceInjectionUtilities.getResourceAnnotated(injectionPoint).getAnnotation(EJB.class); String mappedName = ejb.mappedName(); if (!mappedName.equals("")) { return mappedName; } String name = ejb.name(); if (!name.equals("")) { return ResourceInjectionUtilities.RESOURCE_LOOKUP_PREFIX + "/" + name; } String propertyName; if (injectionPoint.getMember() instanceof Field) { propertyName = injectionPoint.getMember().getName(); } else if (injectionPoint.getMember() instanceof Method) { propertyName = ResourceInjectionUtilities.getPropertyName((Method) injectionPoint.getMember()); if (propertyName == null) { throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) injectionPoint.getMember()); } } else { throw WeldLogger.ROOT_LOGGER.cannotInject(injectionPoint); } String className = injectionPoint.getMember().getDeclaringClass().getName(); return ResourceInjectionUtilities.RESOURCE_LOOKUP_PREFIX + "/" + className + "/" + propertyName; }
throw WeldLogger.ROOT_LOGGER.injectionPointNotAJavabean((Method) injectionPoint.getMember());