public void defineDecoratorRules() { checkDecoratorConditions(); defineDecoratedTypes(); }
protected List<AnnotatedMethod<?>> getPostConstructMethods() { List<AnnotatedMethod<?>> postConstructMethods = new ArrayList<>(); collectPostConstructMethods(annotatedType.getJavaClass(), postConstructMethods); return postConstructMethods; }
protected List<AnnotatedMethod<?>> getPreDestroyMethods() { List<AnnotatedMethod<?>> preDestroyMethods = new ArrayList<>(); collectPreDestroyMethods(annotatedType.getJavaClass(), preDestroyMethods); return preDestroyMethods; }
DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext, annotatedType, attributes); DecoratorBean<T> decorator = null; if (dbb.isDecoratorEnabled()) dbb.defineDecoratorRules(); decorator = dbb.getBean(); webBeansContext.getDecoratorsManager().addDecorator(decorator);
public DecoratorBeanBuilder(WebBeansContext webBeansContext, AnnotatedType<T> annotatedType, BeanAttributes<T> beanAttributes) { Asserts.assertNotNull(webBeansContext, Asserts.PARAM_NAME_WEBBEANSCONTEXT); Asserts.assertNotNull(annotatedType, "annotated type"); Asserts.assertNotNull(beanAttributes, "beanAttributes"); this.webBeansContext = webBeansContext; this.annotatedType = annotatedType; this.beanAttributes = beanAttributes; decoratedTypes = new HashSet<>(beanAttributes.getTypes()); ignoredDecoratorInterfaces = getIgnoredDecoratorInterfaces(); }
public DecoratorBean<T> getBean() { DecoratorBean<T> decorator = new DecoratorBean<>(webBeansContext, WebBeansType.MANAGED, annotatedType, beanAttributes, annotatedType.getJavaClass()); decorator.setEnabled(webBeansContext.getDecoratorsManager().isDecoratorEnabled(annotatedType.getJavaClass())); // we can only do this after the bean injection points got scanned defineDelegate(decorator.getInjectionPoints()); decorator.setDecoratorInfo(decoratedTypes, delegateType, delegateQualifiers); return decorator; }
DecoratorBeanBuilder<T> dbb = new DecoratorBeanBuilder<T>(webBeansContext, annotatedType, attributes); if (dbb.isDecoratorEnabled()) dbb.defineDecoratorRules(); DecoratorBean<T> decorator = dbb.getBean();
private void collectPostConstructMethods(Class<?> type, List<AnnotatedMethod<?>> postConstructMethods) { if (type == null) { return; } collectPostConstructMethods(type.getSuperclass(), postConstructMethods); for (AnnotatedMethod<?> annotatedMethod: webBeansContext.getAnnotatedElementFactory().getFilteredAnnotatedMethods(annotatedType)) { if (annotatedMethod.getJavaMember().getDeclaringClass() == type && annotatedMethod.isAnnotationPresent(PostConstruct.class) && annotatedMethod.getParameters().isEmpty()) { postConstructMethods.add(annotatedMethod); } } }
private void collectPreDestroyMethods(Class<?> type, List<AnnotatedMethod<?>> preDestroyMethods) { if (type == null) { return; } collectPreDestroyMethods(type.getSuperclass(), preDestroyMethods); for (AnnotatedMethod<?> annotatedMethod: webBeansContext.getAnnotatedElementFactory().getFilteredAnnotatedMethods(annotatedType)) { if (annotatedMethod.getJavaMember().getDeclaringClass() == type && annotatedMethod.isAnnotationPresent(PreDestroy.class) && annotatedMethod.getParameters().isEmpty()) { preDestroyMethods.add(annotatedMethod); } } } }