Search in sources :

Example 1 with InterceptorClassMetadata

use of org.jboss.weld.interceptor.spi.metadata.InterceptorClassMetadata in project core by weld.

the class InterceptionModelBuilder method interceptGlobal.

public void interceptGlobal(javax.enterprise.inject.spi.InterceptionType interceptionType, Constructor<?> constructor, Collection<InterceptorClassMetadata<?>> interceptors, Set<Annotation> interceptorBindings) {
    checkModelNotBuilt();
    InterceptionType weldInterceptionType = InterceptionType.valueOf(interceptionType);
    List<InterceptorClassMetadata<?>> interceptorsList = globalInterceptors.get(weldInterceptionType);
    if (interceptorsList == null) {
        interceptorsList = new ArrayList<>();
        globalInterceptors.put(weldInterceptionType, interceptorsList);
    }
    interceptorsList.addAll(interceptors);
    intercept(weldInterceptionType, interceptors);
    if (constructor != null) {
        // WELD-1742 Associate constructor interceptor bindings
        memberInterceptorBindings.put(constructor, interceptorBindings);
    }
}
Also used : InterceptorClassMetadata(org.jboss.weld.interceptor.spi.metadata.InterceptorClassMetadata) InterceptionType(org.jboss.weld.interceptor.spi.model.InterceptionType)

Example 2 with InterceptorClassMetadata

use of org.jboss.weld.interceptor.spi.metadata.InterceptorClassMetadata in project core by weld.

the class InterceptionModelBuilder method interceptMethod.

public void interceptMethod(javax.enterprise.inject.spi.InterceptionType interceptionType, Method method, Collection<InterceptorClassMetadata<?>> interceptors, Set<Annotation> interceptorBindings) {
    checkModelNotBuilt();
    InterceptionType weldInterceptionType = InterceptionType.valueOf(interceptionType);
    if (weldInterceptionType.isLifecycleCallback()) {
        throw new IllegalArgumentException("Illegal interception type: " + interceptionType);
    }
    if (null == methodBoundInterceptors.get(weldInterceptionType)) {
        methodBoundInterceptors.put(weldInterceptionType, new HashMap<>());
    }
    List<InterceptorClassMetadata<?>> interceptorsList = methodBoundInterceptors.get(weldInterceptionType).get(method);
    if (interceptorsList == null) {
        interceptorsList = new ArrayList<>();
        methodBoundInterceptors.get(weldInterceptionType).put(method, interceptorsList);
    }
    interceptorsList.addAll(interceptors);
    intercept(weldInterceptionType, interceptors);
    if (interceptorBindings != null) {
        // WELD-1742 Associate method interceptor bindings
        memberInterceptorBindings.put(method, interceptorBindings);
    }
}
Also used : InterceptorClassMetadata(org.jboss.weld.interceptor.spi.metadata.InterceptorClassMetadata) InterceptionType(org.jboss.weld.interceptor.spi.model.InterceptionType)

Aggregations

InterceptorClassMetadata (org.jboss.weld.interceptor.spi.metadata.InterceptorClassMetadata)2 InterceptionType (org.jboss.weld.interceptor.spi.model.InterceptionType)2