javax.enterprise.inject.spi.Decorator Java Examples

The following examples show how to use javax.enterprise.inject.spi.Decorator. 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: ExceptionControlExtension.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
/**
 * Listener to ProcessBean event to locate handlers.
 *
 * @param processBean current {@link AnnotatedType}
 * @param beanManager  Activated Bean Manager
 * @throws TypeNotPresentException if any of the actual type arguments refers to a non-existent type declaration
 *                                 when trying to obtain the actual type arguments from a
 *                                 {@link java.lang.reflect.ParameterizedType}
 * @throws java.lang.reflect.MalformedParameterizedTypeException
 *                                 if any of the actual type parameters refer to a parameterized type that cannot
 *                                 be instantiated for any reason when trying to obtain the actual type arguments
 *                                 from a {@link java.lang.reflect.ParameterizedType}
 */
@SuppressWarnings("UnusedDeclaration")
public <T> void findHandlers(@Observes final ProcessBean<?> processBean, final BeanManager beanManager)
{
    if (!isActivated)
    {
        return;
    }

    if (processBean.getBean() instanceof Interceptor || processBean.getBean() instanceof Decorator ||
            !(processBean.getAnnotated() instanceof AnnotatedType))
    {
        return;
    }

    AnnotatedType annotatedType = (AnnotatedType)processBean.getAnnotated();

    if (annotatedType.getJavaClass().isAnnotationPresent(ExceptionHandler.class))
    {
        final Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();

        for (AnnotatedMethod<? super T> method : methods)
        {
            if (HandlerMethodImpl.isHandler(method))
            {
                if (method.getJavaMember().getExceptionTypes().length != 0)
                {
                    processBean.addDefinitionError(new IllegalArgumentException(
                        String.format("Handler method %s must not throw exceptions", method.getJavaMember())));
                }

                //beanManager won't be stored in the instance -> no issue with wls12c
                registerHandlerMethod(new HandlerMethodImpl(processBean.getBean(), method, beanManager));
            }
        }
    }
}
 
Example #2
Source File: BeanManagerImpl.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... qualifiers) {
    throw new UnsupportedOperationException();
}
 
Example #3
Source File: ProxyRefreshAgent.java    From HotswapAgent with GNU General Public License v2.0 3 votes vote down vote up
private static void recreateInterceptedProxy(ClassLoader appClassLoader, Bean bean, WebBeansContext wbc) {

        if (!(bean instanceof OwbBean) || bean instanceof Interceptor || bean instanceof Decorator) {
            return;
        }

        OwbBean owbBean = (OwbBean) bean;

        AbstractProducer producer = (AbstractProducer) owbBean.getProducer();
        AnnotatedType annotatedType = ((InjectionTargetBean) owbBean).getAnnotatedType();

        producer.defineInterceptorStack(bean, annotatedType, wbc);
    }