javax.enterprise.inject.spi.InterceptionType Java Examples

The following examples show how to use javax.enterprise.inject.spi.InterceptionType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InterceptorGenerator.java    From quarkus with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @see InjectableInterceptor#intercept(InterceptionType, Object, javax.interceptor.InvocationContext)
 */
protected void implementIntercept(ClassCreator creator, InterceptorInfo interceptor, String providerTypeName,
        ReflectionRegistration reflectionRegistration, boolean isApplicationClass) {
    MethodCreator intercept = creator
            .getMethodCreator("intercept", Object.class, InterceptionType.class, Object.class, InvocationContext.class)
            .setModifiers(ACC_PUBLIC).addException(Exception.class);

    addIntercept(intercept, interceptor.getAroundInvoke(), InterceptionType.AROUND_INVOKE, providerTypeName,
            reflectionRegistration, isApplicationClass);
    addIntercept(intercept, interceptor.getPostConstruct(), InterceptionType.POST_CONSTRUCT, providerTypeName,
            reflectionRegistration, isApplicationClass);
    addIntercept(intercept, interceptor.getPreDestroy(), InterceptionType.PRE_DESTROY, providerTypeName,
            reflectionRegistration, isApplicationClass);
    addIntercept(intercept, interceptor.getAroundConstruct(), InterceptionType.AROUND_CONSTRUCT, providerTypeName,
            reflectionRegistration, isApplicationClass);
    intercept.returnValue(intercept.loadNull());
}
 
Example #2
Source File: BeanManagerTest.java    From quarkus with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("serial")
@Test
public void testResolveInterceptors() {
    BeanManager beanManager = Arc.container().beanManager();
    List<javax.enterprise.inject.spi.Interceptor<?>> interceptors;
    // InterceptionType does not match
    interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT, new DummyBinding.Literal(true, true));
    assertTrue(interceptors.isEmpty());
    // alpha is @Nonbinding
    interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, new DummyBinding.Literal(false, true),
            new AnnotationLiteral<UselessBinding>() {
            });
    assertEquals(2, interceptors.size());
    assertEquals(DummyInterceptor.class, interceptors.get(0).getBeanClass());
    assertEquals(LowPriorityInterceptor.class, interceptors.get(1).getBeanClass());
}
 
Example #3
Source File: BeanInfo.java    From quarkus with Apache License 2.0 6 votes vote down vote up
private Map<InterceptionType, InterceptionInfo> initLifecycleInterceptors() {
    if (!isInterceptor() && isClassBean()) {
        Map<InterceptionType, InterceptionInfo> lifecycleInterceptors = new HashMap<>();
        Set<AnnotationInstance> classLevelBindings = new HashSet<>();
        Set<AnnotationInstance> constructorLevelBindings = new HashSet<>();
        addClassLevelBindings(target.get().asClass(), classLevelBindings);
        addConstructorLevelBindings(target.get().asClass(), constructorLevelBindings);
        putLifecycleInterceptors(lifecycleInterceptors, classLevelBindings, InterceptionType.POST_CONSTRUCT);
        putLifecycleInterceptors(lifecycleInterceptors, classLevelBindings, InterceptionType.PRE_DESTROY);
        constructorLevelBindings.addAll(classLevelBindings);
        putLifecycleInterceptors(lifecycleInterceptors, constructorLevelBindings, InterceptionType.AROUND_CONSTRUCT);
        return lifecycleInterceptors;
    } else {
        return Collections.emptyMap();
    }
}
 
Example #4
Source File: InterceptorGenerator.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private void addIntercepts(InterceptorInfo interceptor, InterceptionType interceptionType, MethodCreator intercepts) {
    if (interceptor.intercepts(interceptionType)) {
        ResultHandle enumValue = intercepts
                .readStaticField(FieldDescriptor.of(InterceptionType.class.getName(), interceptionType.name(),
                        InterceptionType.class.getName()));
        BranchResult result = intercepts
                .ifNonZero(intercepts.invokeVirtualMethod(MethodDescriptors.OBJECT_EQUALS, enumValue,
                        intercepts.getMethodParam(0)));
        result.trueBranch().returnValue(result.trueBranch().load(true));
    }
}
 
Example #5
Source File: DeltaSpikeProxyInterceptorLookup.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
private List<Interceptor<?>> resolveInterceptors(Object instance, Method method)
{
    BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
    
    Annotation[] interceptorBindings = extractInterceptorBindings(beanManager, instance, method);
    if (interceptorBindings.length > 0)
    {
        return beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, interceptorBindings);
    }

    return new ArrayList<>();
}
 
Example #6
Source File: InterceptorData.java    From tomee with Apache License 2.0 5 votes vote down vote up
public InterceptorData(CdiInterceptorBean cdiInterceptorBean) {
    this.cdiInterceptorBean = cdiInterceptorBean;
    this.clazz = cdiInterceptorBean.getBeanClass();
    this.aroundInvoke.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.AROUND_INVOKE));
    this.postConstruct.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.POST_CONSTRUCT));
    this.preDestroy.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.PRE_DESTROY));
    this.postActivate.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.POST_ACTIVATE));
    this.prePassivate.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.PRE_PASSIVATE));
    this.aroundTimeout.addAll(getInterceptionMethodAsListOrEmpty(cdiInterceptorBean, InterceptionType.AROUND_TIMEOUT));
    /*
     AfterBegin, BeforeCompletion and AfterCompletion are ignored since not handled by CDI
     */
}
 
Example #7
Source File: WebappBeanManager.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings) {
    final List<Interceptor<?>> interceptors = super.resolveInterceptors(type, interceptorBindings);
    final List<Interceptor<?>> parentInterceptors = getParentBm().resolveInterceptors(type, interceptorBindings);
    for (final Interceptor<?> i : parentInterceptors) {
        if (!interceptors.contains(i)) {
            interceptors.add(i);
        }
    }
    return interceptors;
}
 
Example #8
Source File: BeanInfo.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private void putLifecycleInterceptors(Map<InterceptionType, InterceptionInfo> lifecycleInterceptors,
        Set<AnnotationInstance> classLevelBindings,
        InterceptionType interceptionType) {
    List<InterceptorInfo> interceptors = beanDeployment.getInterceptorResolver().resolve(interceptionType,
            classLevelBindings);
    if (!interceptors.isEmpty()) {
        lifecycleInterceptors.put(interceptionType, new InterceptionInfo(interceptors, classLevelBindings));
    }
}
 
Example #9
Source File: BeanInfo.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private Map<MethodInfo, InterceptionInfo> initInterceptedMethods(List<Throwable> errors,
        Consumer<BytecodeTransformer> bytecodeTransformerConsumer, boolean transformUnproxyableClasses) {
    if (!isInterceptor() && isClassBean()) {
        Map<MethodInfo, InterceptionInfo> interceptedMethods = new HashMap<>();
        Map<MethodKey, Set<AnnotationInstance>> candidates = new HashMap<>();

        List<AnnotationInstance> classLevelBindings = new ArrayList<>();
        addClassLevelBindings(target.get().asClass(), classLevelBindings);
        if (!stereotypes.isEmpty()) {
            for (StereotypeInfo stereotype : stereotypes) {
                addClassLevelBindings(stereotype.getTarget(), classLevelBindings);
            }
        }

        Set<MethodInfo> finalMethods = Methods.addInterceptedMethodCandidates(beanDeployment, target.get().asClass(),
                candidates, classLevelBindings, bytecodeTransformerConsumer, transformUnproxyableClasses);
        if (!finalMethods.isEmpty()) {
            errors.add(new DeploymentException(String.format(
                    "Intercepted methods of the bean %s may not be declared final:\n\t- %s", getBeanClass(),
                    finalMethods.stream().map(Object::toString).sorted().collect(Collectors.joining("\n\t- ")))));
            return Collections.emptyMap();
        }

        for (Entry<MethodKey, Set<AnnotationInstance>> entry : candidates.entrySet()) {
            List<InterceptorInfo> interceptors = beanDeployment.getInterceptorResolver()
                    .resolve(InterceptionType.AROUND_INVOKE, entry.getValue());
            if (!interceptors.isEmpty()) {
                interceptedMethods.put(entry.getKey().method, new InterceptionInfo(interceptors, entry.getValue()));
            }
        }
        return interceptedMethods;
    } else {
        return Collections.emptyMap();
    }
}
 
Example #10
Source File: InterceptorGenerator.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @return the method
 * @see InjectableInterceptor#intercepts(javax.enterprise.inject.spi.InterceptionType)
 */
protected void implementIntercepts(ClassCreator creator, InterceptorInfo interceptor) {
    MethodCreator intercepts = creator.getMethodCreator("intercepts", boolean.class, InterceptionType.class)
            .setModifiers(ACC_PUBLIC);
    addIntercepts(interceptor, InterceptionType.AROUND_INVOKE, intercepts);
    addIntercepts(interceptor, InterceptionType.POST_CONSTRUCT, intercepts);
    addIntercepts(interceptor, InterceptionType.PRE_DESTROY, intercepts);
    addIntercepts(interceptor, InterceptionType.AROUND_CONSTRUCT, intercepts);
    intercepts.returnValue(intercepts.load(false));
}
 
Example #11
Source File: SubclassGenerator.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param classOutput
 * @param bean
 * @param subclass
 * @param preDestroysField
 */
protected void createDestroy(ClassOutput classOutput, BeanInfo bean, ClassCreator subclass,
        FieldDescriptor preDestroysField) {
    if (preDestroysField != null) {
        MethodCreator destroy = subclass
                .getMethodCreator(MethodDescriptor.ofMethod(subclass.getClassName(), DESTROY_METHOD_NAME, void.class));
        ResultHandle predestroysHandle = destroy.readInstanceField(preDestroysField, destroy.getThis());

        // Interceptor bindings
        ResultHandle bindingsHandle = destroy.newInstance(MethodDescriptor.ofConstructor(HashSet.class));
        for (AnnotationInstance binding : bean.getLifecycleInterceptors(InterceptionType.PRE_DESTROY).bindings) {
            // Create annotation literals first
            ClassInfo bindingClass = bean.getDeployment().getInterceptorBinding(binding.name());
            destroy.invokeInterfaceMethod(MethodDescriptors.SET_ADD, bindingsHandle,
                    annotationLiterals.process(destroy, classOutput, bindingClass, binding,
                            Types.getPackageName(subclass.getClassName())));
        }

        // try
        TryBlock tryCatch = destroy.tryBlock();
        // catch (Exception e)
        CatchBlockCreator exception = tryCatch.addCatch(Exception.class);
        // throw new RuntimeException(e)
        exception.throwException(RuntimeException.class, "Error destroying subclass", exception.getCaughtException());

        // InvocationContextImpl.preDestroy(this,predestroys)
        ResultHandle invocationContext = tryCatch.invokeStaticMethod(MethodDescriptors.INVOCATION_CONTEXTS_PRE_DESTROY,
                tryCatch.getThis(), predestroysHandle,
                bindingsHandle);

        // InvocationContext.proceed()
        tryCatch.invokeInterfaceMethod(MethodDescriptors.INVOCATION_CONTEXT_PROCEED, invocationContext);
        destroy.returnValue(null);
    }
}
 
Example #12
Source File: InterceptorInfo.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public boolean intercepts(InterceptionType interceptionType) {
    switch (interceptionType) {
        case AROUND_INVOKE:
            return aroundInvoke != null;
        case AROUND_CONSTRUCT:
            return aroundConstruct != null;
        case POST_CONSTRUCT:
            return postConstruct != null;
        case PRE_DESTROY:
            return preDestroy != null;
        default:
            return false;
    }
}
 
Example #13
Source File: InterceptorResolver.java    From quarkus with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param interceptionType
 * @param bindings
 * @return the list of interceptors for a set of interceptor bindings and a type of interception
 */
public List<InterceptorInfo> resolve(InterceptionType interceptionType, Set<AnnotationInstance> bindings) {
    if (bindings.isEmpty()) {
        return Collections.emptyList();
    }
    List<InterceptorInfo> interceptors = new ArrayList<>();
    for (InterceptorInfo interceptor : beanDeployment.getInterceptors()) {
        if (!interceptor.intercepts(interceptionType)) {
            continue;
        }
        boolean matches = true;
        for (AnnotationInstance interceptorBinding : interceptor.getBindings()) {
            if (!hasInterceptorBinding(bindings, interceptorBinding)) {
                matches = false;
                break;
            }
        }
        if (matches) {
            interceptors.add(interceptor);
        }
    }
    if (interceptors.isEmpty()) {
        return Collections.emptyList();
    }
    interceptors.sort(this::compare);
    return interceptors;
}
 
Example #14
Source File: BeanInfo.java    From quarkus with Apache License 2.0 5 votes vote down vote up
boolean hasDefaultDestroy() {
    if (isInterceptor()) {
        return true;
    }
    if (isClassBean()) {
        return getLifecycleInterceptors(InterceptionType.PRE_DESTROY).isEmpty()
                && Beans.getCallbacks(target.get().asClass(), DotNames.PRE_DESTROY, beanDeployment.getIndex()).isEmpty();
    } else {
        return disposer == null;
    }
}
 
Example #15
Source File: MockInterceptorTest.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
@Test
public void testDisabledInterceptor() {
    List<Interceptor<?>> interceptors = weld.getBeanManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, FooBinding.Literal.INSTANCE);
    assertEquals(1, interceptors.size());
    assertEquals(MockInterceptor.class, interceptors.get(0).getBeanClass());
}
 
Example #16
Source File: InterceptorData.java    From tomee with Apache License 2.0 4 votes vote down vote up
private List<Method> getInterceptionMethodAsListOrEmpty(final CdiInterceptorBean cdiInterceptorBean, final InterceptionType aroundInvoke) {
    final Method[] methods = cdiInterceptorBean.getInterceptorMethods(aroundInvoke);
    return methods == null ? Collections.<Method>emptyList() : asList(methods);
}
 
Example #17
Source File: InterceptorGenerator.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private void addIntercept(MethodCreator intercept, MethodInfo interceptorMethod, InterceptionType interceptionType,
        String providerTypeName,
        ReflectionRegistration reflectionRegistration, boolean isApplicationClass) {
    if (interceptorMethod != null) {
        ResultHandle enumValue = intercept
                .readStaticField(FieldDescriptor.of(InterceptionType.class.getName(), interceptionType.name(),
                        InterceptionType.class.getName()));
        BranchResult result = intercept.ifNonZero(
                intercept.invokeVirtualMethod(MethodDescriptors.OBJECT_EQUALS, enumValue, intercept.getMethodParam(0)));
        BytecodeCreator trueBranch = result.trueBranch();
        Class<?> retType = null;
        if (InterceptionType.AROUND_INVOKE.equals(interceptionType)) {
            retType = Object.class;
        } else if (InterceptionType.AROUND_CONSTRUCT.equals(interceptionType)) {
            retType = interceptorMethod.returnType().kind().equals(Type.Kind.VOID) ? void.class : Object.class;
        } else {
            retType = void.class;
        }
        ResultHandle ret;
        if (Modifier.isPrivate(interceptorMethod.flags())) {
            privateMembers.add(isApplicationClass,
                    String.format("Interceptor method %s#%s()", interceptorMethod.declaringClass().name(),
                            interceptorMethod.name()));
            // Use reflection fallback
            ResultHandle paramTypesArray = trueBranch.newArray(Class.class, trueBranch.load(1));
            trueBranch.writeArrayValue(paramTypesArray, 0, trueBranch.loadClass(InvocationContext.class));
            ResultHandle argsArray = trueBranch.newArray(Object.class, trueBranch.load(1));
            trueBranch.writeArrayValue(argsArray, 0, intercept.getMethodParam(2));
            reflectionRegistration.registerMethod(interceptorMethod);
            ret = trueBranch.invokeStaticMethod(MethodDescriptors.REFLECTIONS_INVOKE_METHOD,
                    trueBranch.loadClass(interceptorMethod.declaringClass()
                            .name()
                            .toString()),
                    trueBranch.load(interceptorMethod.name()), paramTypesArray, intercept.getMethodParam(1), argsArray);
        } else {
            ret = trueBranch.invokeVirtualMethod(
                    MethodDescriptor.ofMethod(providerTypeName, interceptorMethod.name(), retType, InvocationContext.class),
                    intercept.getMethodParam(1), intercept.getMethodParam(2));
        }
        trueBranch.returnValue(InterceptionType.AROUND_INVOKE.equals(interceptionType) ? ret : trueBranch.loadNull());
    }
}
 
Example #18
Source File: CDIInterceptorWrapperImpl.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static Map<Method, List<InterceptorInvoker>> initInterceptorInvokers(BeanManager beanManager,
                                                                             CreationalContext<?> creationalContext,
                                                                             Class<?> restClient) {
    Map<Method, List<InterceptorInvoker>> invokers = new HashMap<>();
    // Interceptor as a key in a map is not entirely correct (custom interceptors) but should work in most cases
    Map<Interceptor<?>, Object> interceptorInstances = new HashMap<>();
    
    AnnotatedType<?> restClientType = beanManager.createAnnotatedType(restClient);

    List<Annotation> classBindings = getBindings(restClientType.getAnnotations(), beanManager);

    for (AnnotatedMethod<?> method : restClientType.getMethods()) {
        Method javaMethod = method.getJavaMember();
        if (javaMethod.isDefault() || method.isStatic()) {
            continue;
        }
        List<Annotation> methodBindings = getBindings(method.getAnnotations(), beanManager);

        if (!classBindings.isEmpty() || !methodBindings.isEmpty()) {
            Annotation[] interceptorBindings = merge(methodBindings, classBindings);

            List<Interceptor<?>> interceptors =
                new ArrayList<>(beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, 
                                                                interceptorBindings));
            if (LOG.isLoggable(Level.FINEST)) {
                LOG.finest("Resolved interceptors from beanManager, " + beanManager + ":" + interceptors);
            }

            if (!interceptors.isEmpty()) {
                List<InterceptorInvoker> chain = new ArrayList<>();
                for (Interceptor<?> interceptor : interceptors) {
                    chain.add(
                        new InterceptorInvoker(interceptor, 
                                               interceptorInstances.computeIfAbsent(interceptor, 
                                                   i -> beanManager.getReference(i, 
                                                                                 i.getBeanClass(), 
                                                                                 creationalContext))));
                }
                invokers.put(javaMethod, chain);
            }
        }
    }
    return invokers.isEmpty() ? Collections.emptyMap() : invokers;
}
 
Example #19
Source File: InterceptorInvoker.java    From cxf with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
Object invoke(InvocationContext ctx) throws Exception {
    return interceptor.intercept(InterceptionType.AROUND_INVOKE, interceptorInstance, ctx);
}
 
Example #20
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
public MockInterceptor preDestroy(InterceptionCallback callback) {
    return type(InterceptionType.PRE_DESTROY).callback(callback).build();
}
 
Example #21
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
public MockInterceptor postConstruct(InterceptionCallback callback) {
    return type(InterceptionType.POST_CONSTRUCT).callback(callback).build();
}
 
Example #22
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
public MockInterceptor aroundConstruct(InterceptionCallback callback) {
    return type(InterceptionType.AROUND_CONSTRUCT).callback(callback).build();
}
 
Example #23
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
public MockInterceptor aroundInvoke(InterceptionCallback callback) {
    return type(InterceptionType.AROUND_INVOKE).callback(callback).build();
}
 
Example #24
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
@Override
public Object intercept(InterceptionType type, MockInterceptorInstance instance, InvocationContext ctx) throws Exception {
    return callback.invoke(ctx, instance.getInterceptedBean());
}
 
Example #25
Source File: MockInterceptor.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
@Override
public boolean intercepts(InterceptionType type) {
    return this.type.equals(type);
}
 
Example #26
Source File: MockInterceptorTest.java    From weld-junit with Apache License 2.0 4 votes vote down vote up
@Test
public void testDisabledInterceptor() {
    List<Interceptor<?>> interceptors = weld.getBeanManager().resolveInterceptors(InterceptionType.AROUND_INVOKE, FooBinding.Literal.INSTANCE);
    assertEquals(1, interceptors.size());
    assertEquals(MockInterceptor.class, interceptors.get(0).getBeanClass());
}
 
Example #27
Source File: InterceptedStaticMethodsProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@BuildStep
void collectInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
        BuildProducer<InterceptedStaticMethodBuildItem> interceptedStaticMethods,
        InterceptorResolverBuildItem interceptorResolver, TransformedAnnotationsBuildItem transformedAnnotations) {

    // In this step we collect all intercepted static methods, ie. static methods annotated with interceptor bindings  
    Set<DotName> interceptorBindings = interceptorResolver.getInterceptorBindings();

    for (ClassInfo clazz : beanArchiveIndex.getIndex().getKnownClasses()) {
        for (MethodInfo method : clazz.methods()) {
            // Find all static methods (except for static initializers)
            if (!Modifier.isStatic(method.flags()) || "<clinit>".equals(method.name())) {
                continue;
            }
            // Get the (possibly transformed) set of annotations
            Collection<AnnotationInstance> annotations = transformedAnnotations.getAnnotations(method);
            if (annotations.isEmpty()) {
                continue;
            }
            // Only method-level bindings are considered due to backwards compatibility
            Set<AnnotationInstance> methodLevelBindings = null;
            for (AnnotationInstance annotationInstance : annotations) {
                if (annotationInstance.target().kind() == Kind.METHOD
                        && interceptorBindings.contains(annotationInstance.name())) {
                    if (methodLevelBindings == null) {
                        methodLevelBindings = new HashSet<>();
                    }
                    methodLevelBindings.add(annotationInstance);
                }
            }
            if (methodLevelBindings == null || methodLevelBindings.isEmpty()) {
                continue;
            }
            if (Modifier.isPrivate(method.flags())) {
                LOGGER.warnf(
                        "Interception of private static methods is not supported; bindings found on %s: %s",
                        method.declaringClass().name(),
                        method);
            } else {
                List<InterceptorInfo> interceptors = interceptorResolver.get().resolve(
                        InterceptionType.AROUND_INVOKE,
                        methodLevelBindings);
                if (!interceptors.isEmpty()) {
                    LOGGER.debugf("Intercepted static method found on %s: %s", method.declaringClass().name(),
                            method);
                    interceptedStaticMethods.produce(
                            new InterceptedStaticMethodBuildItem(method, methodLevelBindings, interceptors));
                }
            }
        }
    }
}
 
Example #28
Source File: BeanManagerImpl.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings) {
    return ArcContainerImpl.instance().resolveInterceptors(Objects.requireNonNull(type), interceptorBindings);
}
 
Example #29
Source File: InitializedInterceptor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Object intercept(InterceptionType type, T instance, InvocationContext ctx) throws Exception {
    return delegate.intercept(type, instance, ctx);
}
 
Example #30
Source File: InitializedInterceptor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public boolean intercepts(InterceptionType type) {
    return delegate.intercepts(type);
}