Refine search
public DecoratorInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager) { super(type, bean, beanManager); this.delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, getInjectionPoints()); if (delegateInjectionPoint instanceof FieldInjectionPoint<?, ?>) { FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) delegateInjectionPoint; this.accessibleField = AccessController.doPrivileged(new GetAccessibleCopyOfMember<Field>(fip.getAnnotated().getJavaMember())); } else { this.accessibleField = null; } checkAbstractMethods(type); }
@SuppressWarnings("unchecked") private void checkAbstractMethods(EnhancedAnnotatedType<T> type) { if(!type.isAbstract()) { return; } Set<Type> decoratedTypes = null; Bean<?> bean = getBean(); if(bean != null && (bean instanceof DecoratorImpl)) { decoratedTypes = ((DecoratorImpl<T>)bean).getDecoratedTypes(); } Decorators.checkAbstractMethods(decoratedTypes, type, beanManager); } }
@Override public void inject(T instance, CreationalContext<T> ctx) { super.inject(instance, ctx); if (accessibleField != null && instance instanceof DecoratorProxy) { // this code is only applicable if the delegate is injected into a field // as the proxy can't intercept the delegate when setting the field // we need to now read the delegate from the field // this is only needed for fields, as constructor and method injection are handed // at injection time Object delegate; try { delegate = accessibleField.get(instance); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } final ProxyMethodHandler handler = new ProxyMethodHandler(beanManager.getContextId(), new TargetBeanInstance(delegate), getBean()); ((ProxyObject) instance).weld_setHandler(handler); } }
private BasicInjectionTarget<T> chooseInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, boolean interceptor) { if (bean instanceof Decorator<?> || type.isAnnotationPresent(javax.decorator.Decorator.class)) { return new DecoratorInjectionTarget<T>(type, bean, manager); } NonProducibleInjectionTarget<T> nonProducible = InjectionTargets.createNonProducibleInjectionTarget(type, bean, manager); if(nonProducible != null) { return nonProducible; } if (bean instanceof SessionBean<?>) { return SessionBeanInjectionTarget.of(type, (SessionBean<T>) bean, manager); } if (bean instanceof Interceptor<?> || type.isAnnotationPresent(javax.interceptor.Interceptor.class)) { return BeanInjectionTarget.forCdiInterceptor(type, bean, manager); } if (interceptor) { return BasicInjectionTarget.createNonCdiInterceptor(type, manager); } return BeanInjectionTarget.createDefault(type, bean, manager); }
@Override public void inject(T instance, CreationalContext<T> ctx) { super.inject(instance, ctx); if (accessibleField != null && instance instanceof DecoratorProxy) { // this code is only applicable if the delegate is injected into a field // as the proxy can't intercept the delegate when setting the field // we need to now read the delegate from the field // this is only needed for fields, as constructor and method injection are handed // at injection time Object delegate; try { delegate = accessibleField.get(instance); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } final ProxyMethodHandler handler = new ProxyMethodHandler(beanManager.getContextId(), new TargetBeanInstance(delegate), getBean()); ((ProxyObject) instance).setHandler(handler); } }
private BasicInjectionTarget<T> chooseInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, boolean interceptor) { if (bean instanceof Decorator<?> || type.isAnnotationPresent(javax.decorator.Decorator.class)) { return new DecoratorInjectionTarget<T>(type, bean, manager); } NonProducibleInjectionTarget<T> nonProducible = InjectionTargets.createNonProducibleInjectionTarget(type, bean, manager); if (nonProducible != null) { return nonProducible; } if (bean instanceof SessionBean<?>) { return manager.getServices().get(EjbSupport.class).createSessionBeanInjectionTarget(type, (SessionBean<T>) bean, manager); } if (bean instanceof Interceptor<?> || type.isAnnotationPresent(javax.interceptor.Interceptor.class)) { return BeanInjectionTarget.forCdiInterceptor(type, bean, manager); } if (interceptor) { return BasicInjectionTarget.createNonCdiInterceptor(type, manager); } return BeanInjectionTarget.createDefault(type, bean, manager); }
public DecoratorInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager) { super(type, bean, beanManager); this.delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, getInjectionPoints()); if (delegateInjectionPoint instanceof FieldInjectionPoint<?, ?>) { FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) delegateInjectionPoint; this.accessibleField = AccessController.doPrivileged(new GetAccessibleCopyOfMember<Field>(fip.getAnnotated().getJavaMember())); } else { this.accessibleField = null; } checkAbstractMethods(type); }
@SuppressWarnings("unchecked") private void checkAbstractMethods(EnhancedAnnotatedType<T> type) { if(!type.isAbstract()) { return; } Set<Type> decoratedTypes = null; Bean<?> bean = getBean(); if(bean != null && (bean instanceof DecoratorImpl)) { decoratedTypes = ((DecoratorImpl<T>)bean).getDecoratedTypes(); } Decorators.checkAbstractMethods(decoratedTypes, type, beanManager); } }
@Override public void inject(T instance, CreationalContext<T> ctx) { super.inject(instance, ctx); if (accessibleField != null && instance instanceof DecoratorProxy) { // this code is only applicable if the delegate is injected into a field // as the proxy can't intercept the delegate when setting the field // we need to now read the delegate from the field // this is only needed for fields, as constructor and method injection are handed // at injection time Object delegate; try { delegate = accessibleField.get(instance); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } final ProxyMethodHandler handler = new ProxyMethodHandler(beanManager.getContextId(), new TargetBeanInstance(delegate), getBean()); ((ProxyObject) instance).weld_setHandler(handler); } }
private BasicInjectionTarget<T> chooseInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, boolean interceptor) { if (bean instanceof Decorator<?> || type.isAnnotationPresent(javax.decorator.Decorator.class)) { return new DecoratorInjectionTarget<T>(type, bean, manager); } NonProducibleInjectionTarget<T> nonProducible = InjectionTargets.createNonProducibleInjectionTarget(type, bean, manager); if (nonProducible != null) { return nonProducible; } if (bean instanceof SessionBean<?>) { return manager.getServices().get(EjbSupport.class).createSessionBeanInjectionTarget(type, (SessionBean<T>) bean, manager); } if (bean instanceof Interceptor<?> || type.isAnnotationPresent(javax.interceptor.Interceptor.class)) { return BeanInjectionTarget.forCdiInterceptor(type, bean, manager); } if (interceptor) { return BasicInjectionTarget.createNonCdiInterceptor(type, manager); } return BeanInjectionTarget.createDefault(type, bean, manager); }
public DecoratorInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager) { super(type, bean, beanManager); this.delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, getInjectionPoints()); if (delegateInjectionPoint instanceof FieldInjectionPoint<?, ?>) { FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) delegateInjectionPoint; this.accessibleField = AccessController.doPrivileged(new GetAccessibleCopyOfMember<Field>(fip.getAnnotated().getJavaMember())); } else { this.accessibleField = null; } checkAbstractMethods(type); }
@SuppressWarnings("unchecked") private void checkAbstractMethods(EnhancedAnnotatedType<T> type) { if(!type.isAbstract()) { return; } Set<Type> decoratedTypes = null; Bean<?> bean = getBean(); if(bean != null && (bean instanceof DecoratorImpl)) { decoratedTypes = ((DecoratorImpl<T>)bean).getDecoratedTypes(); } Decorators.checkAbstractMethods(decoratedTypes, type, beanManager); } }
@Override public void inject(T instance, CreationalContext<T> ctx) { super.inject(instance, ctx); if (accessibleField != null && instance instanceof DecoratorProxy) { // this code is only applicable if the delegate is injected into a field // as the proxy can't intercept the delegate when setting the field // we need to now read the delegate from the field // this is only needed for fields, as constructor and method injection are handed // at injection time Object delegate; try { delegate = accessibleField.get(instance); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } final ProxyMethodHandler handler = new ProxyMethodHandler(beanManager.getContextId(), new TargetBeanInstance(delegate), getBean()); ((ProxyObject) instance).weld_setHandler(handler); } }
private BasicInjectionTarget<T> chooseInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, boolean interceptor) { if (bean instanceof Decorator<?> || type.isAnnotationPresent(javax.decorator.Decorator.class)) { return new DecoratorInjectionTarget<T>(type, bean, manager); } NonProducibleInjectionTarget<T> nonProducible = InjectionTargets.createNonProducibleInjectionTarget(type, bean, manager); if (nonProducible != null) { return nonProducible; } if (bean instanceof SessionBean<?>) { return manager.getServices().get(EjbSupport.class).createSessionBeanInjectionTarget(type, (SessionBean<T>) bean, manager); } if (bean instanceof Interceptor<?> || type.isAnnotationPresent(javax.interceptor.Interceptor.class)) { return BeanInjectionTarget.forCdiInterceptor(type, bean, manager); } if (interceptor) { return BasicInjectionTarget.createNonCdiInterceptor(type, manager); } return BeanInjectionTarget.createDefault(type, bean, manager); }
public DecoratorInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager) { super(type, bean, beanManager); this.delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, getInjectionPoints()); if (delegateInjectionPoint instanceof FieldInjectionPoint<?, ?>) { FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) delegateInjectionPoint; this.accessibleField = AccessController.doPrivileged(new GetAccessibleCopyOfMember<Field>(fip.getAnnotated().getJavaMember())); } else { this.accessibleField = null; } checkAbstractMethods(type); }
@SuppressWarnings("unchecked") private void checkAbstractMethods(EnhancedAnnotatedType<T> type) { if(!type.isAbstract()) { return; } Set<Type> decoratedTypes = null; Bean<?> bean = getBean(); if(bean != null && (bean instanceof DecoratorImpl)) { decoratedTypes = ((DecoratorImpl<T>)bean).getDecoratedTypes(); } Decorators.checkAbstractMethods(decoratedTypes, type, beanManager); } }
@Override public void inject(T instance, CreationalContext<T> ctx) { super.inject(instance, ctx); if (accessibleField != null && instance instanceof DecoratorProxy) { // this code is only applicable if the delegate is injected into a field // as the proxy can't intercept the delegate when setting the field // we need to now read the delegate from the field // this is only needed for fields, as constructor and method injection are handed // at injection time Object delegate; try { delegate = accessibleField.get(instance); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } final ProxyMethodHandler handler = new ProxyMethodHandler(beanManager.getContextId(), new TargetBeanInstance(delegate), getBean()); ((ProxyObject) instance).weld_setHandler(handler); } }
private BasicInjectionTarget<T> chooseInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, boolean interceptor) { if (bean instanceof Decorator<?> || type.isAnnotationPresent(javax.decorator.Decorator.class)) { return new DecoratorInjectionTarget<T>(type, bean, manager); } NonProducibleInjectionTarget<T> nonProducible = InjectionTargets.createNonProducibleInjectionTarget(type, bean, manager); if (nonProducible != null) { return nonProducible; } if (bean instanceof SessionBean<?>) { return manager.getServices().get(EjbSupport.class).createSessionBeanInjectionTarget(type, (SessionBean<T>) bean, manager); } if (bean instanceof Interceptor<?> || type.isAnnotationPresent(javax.interceptor.Interceptor.class)) { return BeanInjectionTarget.forCdiInterceptor(type, bean, manager); } if (interceptor) { return BasicInjectionTarget.createNonCdiInterceptor(type, manager); } return BeanInjectionTarget.createDefault(type, bean, manager); }
public DecoratorInjectionTarget(EnhancedAnnotatedType<T> type, Bean<T> bean, BeanManagerImpl beanManager) { super(type, bean, beanManager); this.delegateInjectionPoint = Decorators.findDelegateInjectionPoint(type, getInjectionPoints()); if (delegateInjectionPoint instanceof FieldInjectionPoint<?, ?>) { FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) delegateInjectionPoint; this.accessibleField = AccessController.doPrivileged(new GetAccessibleCopyOfMember<Field>(fip.getAnnotated().getJavaMember())); } else { this.accessibleField = null; } checkAbstractMethods(type); }
@SuppressWarnings("unchecked") private void checkAbstractMethods(EnhancedAnnotatedType<T> type) { if(!type.isAbstract()) { return; } Set<Type> decoratedTypes = null; Bean<?> bean = getBean(); if(bean != null && (bean instanceof DecoratorImpl)) { decoratedTypes = ((DecoratorImpl<T>)bean).getDecoratedTypes(); } Decorators.checkAbstractMethods(decoratedTypes, type, beanManager); } }