@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).weld_getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).weld_getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).weld_getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).weld_getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@Override public T produce(Object receiver, CreationalContext<T> creationalContext) { // unwrap if we have a proxy if (receiver instanceof TargetInstanceProxy) { receiver = Reflections.<TargetInstanceProxy<T>> cast(receiver).weld_getTargetInstance(); } try { return cast(accessibleField.get(receiver)); } catch (IllegalAccessException e) { throw UtilLogger.LOG.accessErrorOnField(accessibleField.getName(), accessibleField.getDeclaringClass(), e); } }
@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); } }
@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); } }
@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); } }
@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); } }
@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); } }
@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); } }