Search in sources :

Example 1 with OrderedItemContainer

use of org.jboss.as.ee.component.interceptors.OrderedItemContainer in project wildfly by wildfly.

the class ComponentConfiguration method addTimeoutViewInterceptor.

/**
     * Adds a timeout interceptor factory to every method on the component.
     *
     * @param factory  The interceptor factory to add
     * @param priority The interceptors relative order
     */
public void addTimeoutViewInterceptor(InterceptorFactory factory, int priority) {
    for (Method method : (Iterable<Method>) classIndex.getClassMethods()) {
        OrderedItemContainer<InterceptorFactory> interceptors = timeoutInterceptors.get(method);
        if (interceptors == null) {
            timeoutInterceptors.put(method, interceptors = new OrderedItemContainer<InterceptorFactory>());
        }
        interceptors.add(factory, priority);
    }
}
Also used : InterceptorFactory(org.jboss.invocation.InterceptorFactory) OrderedItemContainer(org.jboss.as.ee.component.interceptors.OrderedItemContainer) Method(java.lang.reflect.Method)

Example 2 with OrderedItemContainer

use of org.jboss.as.ee.component.interceptors.OrderedItemContainer in project wildfly by wildfly.

the class ComponentConfiguration method addComponentInterceptors.

/**
     * Adds an interceptor factory to every method on the component.
     *
     * @param factory    The interceptor factory to add
     * @param priority   The interceptors relative order
     * @param publicOnly If true then then interceptor is only added to public methods
     */
public void addComponentInterceptors(List<InterceptorFactory> factory, int priority, boolean publicOnly) {
    for (Method method : (Iterable<Method>) classIndex.getClassMethods()) {
        if (publicOnly && !Modifier.isPublic(method.getModifiers())) {
            continue;
        }
        OrderedItemContainer<List<InterceptorFactory>> interceptors = componentInterceptors.get(method);
        if (interceptors == null) {
            componentInterceptors.put(method, interceptors = new OrderedItemContainer<List<InterceptorFactory>>());
        }
        interceptors.add(factory, priority);
    }
}
Also used : InterceptorFactory(org.jboss.invocation.InterceptorFactory) OrderedItemContainer(org.jboss.as.ee.component.interceptors.OrderedItemContainer) ArrayList(java.util.ArrayList) List(java.util.List) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)2 OrderedItemContainer (org.jboss.as.ee.component.interceptors.OrderedItemContainer)2 InterceptorFactory (org.jboss.invocation.InterceptorFactory)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1