/** * The type of intercepting being done, corresponds to <code>@AroundInvoke</code> etc on * "static" interceptors */ public boolean intercepts(InterceptionType type) { return AROUND_INVOKE.equals(type); }
@Override public List<Interceptor<?>> getLifecycleInterceptors(InterceptionType interceptionType) { if (interceptionType == null) { throw BeanLogger.LOG.interceptionTypeNull(); } org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (!internalInterceptionType.isLifecycleCallback()) { throw BeanLogger.LOG.interceptionTypeNotLifecycle(interceptionType.name()); } if (internalInterceptionType.equals(org.jboss.weld.interceptor.spi.model.InterceptionType.AROUND_CONSTRUCT)) { return extractCdiInterceptors(interceptionModel.getConstructorInvocationInterceptors()); } return extractCdiInterceptors(interceptionModel.getInterceptors(internalInterceptionType, null)); }
@Override public List<Interceptor<?>> getMethodInterceptors(InterceptionType interceptionType, Method method) { if (interceptionType == null) { throw BeanLogger.LOG.interceptionTypeNull(); } if (method == null) { throw BeanLogger.LOG.methodNull(); } org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (internalInterceptionType.isLifecycleCallback()) { throw BeanLogger.LOG.interceptionTypeLifecycle(interceptionType.name()); } return extractCdiInterceptors(interceptionModel.getInterceptors(internalInterceptionType, method)); }
private void initClassDeclaredEjbInterceptors() { Class<?>[] classDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(annotatedType); boolean excludeClassLevelAroundConstructInterceptors = constructor.isAnnotationPresent(ExcludeClassInterceptors.class); if (classDeclaredInterceptors != null) { for (Class<?> clazz : classDeclaredInterceptors) { InterceptorClassMetadata<?> interceptor = reader.getPlainInterceptorMetadata(clazz); for (InterceptionType interceptionType : InterceptionType.values()) { if (excludeClassLevelAroundConstructInterceptors && interceptionType.equals(InterceptionType.AROUND_CONSTRUCT)) { /* * @ExcludeClassInterceptors suppresses @AroundConstruct interceptors defined on class level */ continue; } if (interceptor.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType))) { builder.interceptGlobal(interceptionType, null, Collections.<InterceptorClassMetadata<?>>singleton(interceptor), null); } } } } }
@Override @SuppressWarnings("unchecked") public InterceptorInvocation getInterceptorInvocation(Object interceptorInstance, InterceptionType interceptionType) { return new CustomInterceptorInvocation<T>(factory.getInterceptor(), (T) interceptorInstance, javax.enterprise.inject.spi.InterceptionType.valueOf(interceptionType.name())); }
@Override public boolean intercepts(InterceptionType type) { return interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(type.name())); }
@Override public Object intercept(InterceptionType type, T instance, final InvocationContext ctx) { final org.jboss.weld.interceptor.spi.model.InterceptionType interceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(type .name()); final List<InterceptorMethodInvocation> methodInvocations = interceptorMetadata.getInterceptorInvocation(instance, interceptionType) .getInterceptorMethodInvocations(); Set<Annotation> interceptorBindings = null; if (ctx instanceof org.jboss.weld.interceptor.WeldInvocationContext) { interceptorBindings = Reflections.<org.jboss.weld.interceptor.WeldInvocationContext> cast(ctx).getInterceptorBindings(); } try { /* * Calling Interceptor.intercept() may result in multiple interceptor method invocations (provided the interceptor class interceptor methods on * superclasses). This requires cooperation with InvocationContext. * * We use a wrapper InvocationContext for the purpose of executing the chain of interceptor methods of this interceptor. */ return new WeldInvocationContextImpl(ctx, methodInvocations, interceptorBindings, null).proceed(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WeldException(e); } }
@Override public int hashCode() { int hashCode = _type.hashCode() * 65521; if (_binding != null) hashCode += _binding.hashCode(); if (_interceptors != null) hashCode += _interceptors.hashCode(); return hashCode; }
@Override public String getName() { return getBeanClass().toString() + interceptionType.name() + priority + Formats.formatAnnotations(bindings); }
@Override public List<Interceptor<?>> getLifecycleInterceptors(InterceptionType interceptionType) { if (interceptionType == null) { throw BeanLogger.LOG.interceptionTypeNull(); } org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (!internalInterceptionType.isLifecycleCallback()) { throw BeanLogger.LOG.interceptionTypeNotLifecycle(interceptionType.name()); } if (internalInterceptionType.equals(org.jboss.weld.interceptor.spi.model.InterceptionType.AROUND_CONSTRUCT)) { return extractCdiInterceptors(interceptionModel.getConstructorInvocationInterceptors()); } return extractCdiInterceptors(interceptionModel.getInterceptors(internalInterceptionType, null)); }
@Override public List<Interceptor<?>> getMethodInterceptors(InterceptionType interceptionType, Method method) { if (interceptionType == null) { throw BeanLogger.LOG.interceptionTypeNull(); } if (method == null) { throw BeanLogger.LOG.methodNull(); } org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (internalInterceptionType.isLifecycleCallback()) { throw BeanLogger.LOG.interceptionTypeLifecycle(interceptionType.name()); } return extractCdiInterceptors(interceptionModel.getInterceptors(internalInterceptionType, method)); }
private void initClassDeclaredEjbInterceptors() { Class<?>[] classDeclaredInterceptors = interceptorsApi.extractInterceptorClasses(annotatedType); boolean excludeClassLevelAroundConstructInterceptors = constructor.isAnnotationPresent(ExcludeClassInterceptors.class); if (classDeclaredInterceptors != null) { for (Class<?> clazz : classDeclaredInterceptors) { InterceptorClassMetadata<?> interceptor = reader.getPlainInterceptorMetadata(clazz); for (InterceptionType interceptionType : InterceptionType.values()) { if (excludeClassLevelAroundConstructInterceptors && interceptionType.equals(InterceptionType.AROUND_CONSTRUCT)) { /* * @ExcludeClassInterceptors suppresses @AroundConstruct interceptors defined on class level */ continue; } if (interceptor.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType))) { builder.interceptGlobal(interceptionType, null, Collections.<InterceptorClassMetadata<?>>singleton(interceptor), null); } } } } }
@Override @SuppressWarnings("unchecked") public InterceptorInvocation getInterceptorInvocation(Object interceptorInstance, InterceptionType interceptionType) { return new CustomInterceptorInvocation<T>(factory.getInterceptor(), (T) interceptorInstance, javax.enterprise.inject.spi.InterceptionType.valueOf(interceptionType.name())); }
@Override public boolean intercepts(InterceptionType type) { return interceptorMetadata.isEligible(org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(type.name())); }
@Override public Object intercept(InterceptionType type, T instance, final InvocationContext ctx) { final org.jboss.weld.interceptor.spi.model.InterceptionType interceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(type .name()); final List<InterceptorMethodInvocation> methodInvocations = interceptorMetadata.getInterceptorInvocation(instance, interceptionType) .getInterceptorMethodInvocations(); Set<Annotation> interceptorBindings = null; if (ctx instanceof org.jboss.weld.interceptor.WeldInvocationContext) { interceptorBindings = Reflections.<org.jboss.weld.interceptor.WeldInvocationContext> cast(ctx).getInterceptorBindings(); } try { /* * Calling Interceptor.intercept() may result in multiple interceptor method invocations (provided the interceptor class interceptor methods on * superclasses). This requires cooperation with InvocationContext. * * We use a wrapper InvocationContext for the purpose of executing the chain of interceptor methods of this interceptor. */ return new WeldInvocationContextImpl(ctx, methodInvocations, interceptorBindings, null).proceed(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new WeldException(e); } }
public int hashCode() { return 31 * super.hashCode() + this.getInterceptionType().hashCode(); }
@Override public String getName() { return getBeanClass().toString() + interceptionType.name() + priority + Formats.formatAnnotations(bindings); }
@Override public List<Interceptor<?>> getLifecycleInterceptors(InterceptionType interceptionType) { if (interceptionType == null) { throw BeanLogger.LOG.interceptionTypeNull(); } org.jboss.weld.interceptor.spi.model.InterceptionType internalInterceptionType = org.jboss.weld.interceptor.spi.model.InterceptionType.valueOf(interceptionType.name()); if (!internalInterceptionType.isLifecycleCallback()) { throw BeanLogger.LOG.interceptionTypeNotLifecycle(interceptionType.name()); } if (internalInterceptionType.equals(org.jboss.weld.interceptor.spi.model.InterceptionType.AROUND_CONSTRUCT)) { return extractCdiInterceptors(interceptionModel.getConstructorInvocationInterceptors()); } return extractCdiInterceptors(interceptionModel.getInterceptors(internalInterceptionType, null)); }