/** * 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)); } } } }
@Override public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... qualifiers) { // TODO Auto-generated method stub return null; }
@Override public List<Decorator<?>> resolveDecorators(final Set<Type> arg0, final Annotation... arg1) { return this.beanManager.resolveDecorators(arg0, arg1); }