public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors) { EJB ref = container.getAnnotation(EJB.class, method); if(ref == null) return; String encName = getEncName(ref, method); injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc())); }
public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors) { JndiInject ref = method.getAnnotation(JndiInject.class); if (ref != null) { if (!method.getName().startsWith("set")) throw new RuntimeException("@EJB can only be used with a set method: " + method); String encName = InjectionUtil.getEncName(method); if (!container.getEncInjectors().containsKey(encName)) { container.getEncInjectors().put(encName, new LinkRefEncInjector(encName, ref.jndiName(), "@JndiInject")); } injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc())); } }
private void addInjector(InjectionContainer container, String encName, AnnotatedElement annotatedElement) { Injector jndiInjector; if(annotatedElement instanceof Method) jndiInjector = new JndiMethodInjector((Method)annotatedElement, encName, container.getEnc()); else if(annotatedElement instanceof Field) jndiInjector = new JndiFieldInjector((Field)annotatedElement, encName, container.getEnc()); else throw new IllegalStateException("Annotated element for '" + encName + "' is niether Method nor Field: " + annotatedElement); container.getInjectors().add(jndiInjector); }
private void addInjector(InjectionContainer container, String encName, AnnotatedElement annotatedElement) { Injector jndiInjector = null; if(annotatedElement instanceof Method) { Method method = (Method) annotatedElement; jndiInjector = new JndiMethodInjector(method, encName, container.getEnc()); addInjector(container, method, method.getDeclaringClass(), jndiInjector); } else if(annotatedElement instanceof Field) { Field field = (Field) annotatedElement; jndiInjector = new JndiFieldInjector(field, encName, container.getEnc()); addInjector(container, field, field.getDeclaringClass(), jndiInjector); } else throw new IllegalStateException("Annotated element for '" + encName + "' is niether Method nor Field: " + annotatedElement); }
public void handleMethodAnnotations(Method method, InjectionContainer container, Map<AccessibleObject, Injector> injectors) { PersistenceUnit ref = method.getAnnotation(PersistenceUnit.class); if (ref == null) return; if (!method.getName().startsWith("set")) throw new RuntimeException("@PersistenceUnit can only be used with a set method: " + method); String encName = ref.name(); if (encName == null || encName.equals("")) { encName = InjectionUtil.getEncName(method); } else { encName = "env/" + encName; } if (!container.getEncInjectors().containsKey(encName)) { container.getEncInjectors().put(encName, new PuEncInjector(encName, method.getParameterTypes()[0], ref.unitName(), "@PersistenceUnit")); try { if (!method.isAnnotationPresent(IgnoreDependency.class)) addPUDependency(ref.unitName(), container); } catch (NameNotFoundException e) { throw new RuntimeException("Illegal @PersistenceUnit on " + method + " :" + e.getMessage()); } } injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc())); }
injectors.put(method, new JndiMethodInjector(method, encName, encCtx));
injectors.put(ao, new JndiMethodInjector((Method) ao, encName, container.getEnc()));
container.getEncInjectors().put(encName, new PcEncInjector(encName, ref.unitName(), ref.type(), method.getParameterTypes()[0], error)); injectors.put(method, new JndiMethodInjector(method, encName, container.getEnc()));