BeanAttributesImpl<?> attributes = BeanAttributesBuilder.forContext(wbc).newBeanAttibutes(annotatedType).build(); Map<AnnotatedType<?>, ExtendedBeanAttributes<?>> annotatedTypes = new HashMap<>();
public void defineDecoratorRules() { checkDecoratorConditions(); defineDecoratedTypes(); }
@Override protected void defineNullable() { defineNullable(false); }
/** * Check whether this class has any method which intercepts the whole bean itself. * @return SelfInterceptorBean or <code>null</code> if this bean doesn't intercept itself */ private <T> SelfInterceptorBean<T> resolveSelfInterceptorBean(AnnotatedType<T> annotatedType) { BeanAttributesImpl<T> beanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build(); if (beanAttributes == null) { // might happen if a proxying rule eefines that this is not a valid bean type. return null; } SelfInterceptorBeanBuilder<T> sibb = new SelfInterceptorBeanBuilder<>(webBeansContext, annotatedType, beanAttributes); sibb.defineSelfInterceptorRules(); if (!sibb.isInterceptorEnabled()) { return null; } return sibb.getBean(); }
public <T> BeanAttributesBuilder<T, AnnotatedType<T>> newBeanAttibutes(AnnotatedType<T> annotatedType) { return newBeanAttibutes(annotatedType, false); }
public void defineEjbInterceptorRules() { checkDefaultConstructor(); checkInterceptorConditions(); defineInterceptorMethods(); }
@Override protected void defineName() { defineName(getAnnotated(), () -> getProducerDefaultName(getAnnotated())); }
private Class<?> findClass(ProducerFactory<?> factory, Class<?> type) { if (MethodProducerFactory.class.isInstance(factory)) { return MethodProducerFactory.class.cast(factory).getReturnType(); } if (FieldProducerFactory.class.isInstance(factory)) { return FieldProducerFactory.class.cast(factory).getReturnType(); } return type; }
protected P createBean(Class<T> beanClass) { return createBean(parent, beanClass); } }
public <T> BeanAttributesBuilder<T, AnnotatedMethod<T>> newBeanAttibutes(AnnotatedMethod<T> annotatedMethod) { return new AnnotatedMethodBeanAttributesBuilder<>(webBeansContext, annotatedMethod); } }
public void defineSelfInterceptorRules() { // we do NOT invoke checkInterceptorConditions(); // self-interceptors have different rules! // we do NOT invoke defineInterceptorRules() ! enabled = defineInterceptorMethods(); }
public static BeanAttributesBuilderFactory forContext(WebBeansContext webBeansContext) { return new BeanAttributesBuilderFactory(webBeansContext); }
public <T> BeanAttributesBuilder<T, AnnotatedField<T>> newBeanAttibutes(AnnotatedField<T> annotatedField) { return new AnnotatedFieldBeanAttributesBuilder<>(webBeansContext, annotatedField); }
public <X> ProducerFactory<X> getProducerFactory(AnnotatedMethod<? super X> method, Bean<X> bean) { return new MethodProducerFactory<>(method, bean, webBeansContext); }
public <T> BeanAttributesBuilder<T, AnnotatedType<T>> newBeanAttibutes(AnnotatedType<T> annotatedType, boolean onlyScopedBeans) { return new AnnotatedTypeBeanAttributesBuilder<>(webBeansContext, annotatedType, onlyScopedBeans); }
public <X> ProducerFactory<X> getProducerFactory(AnnotatedField<? super X> field, Bean<X> bean) { return new FieldProducerFactory<>(field, bean, webBeansContext); }
protected void defineScope(String errorMessage) { defineScope(null, false, errorMessage); }
@SuppressWarnings({ "rawtypes", "unchecked" }) private static void createAnnotatedTypeForExistingBeanClass(BeanManagerImpl beanManager, InjectionTargetBean bean) { WebBeansContext wbc = beanManager.getWebBeansContext(); AnnotatedElementFactory annotatedElementFactory = wbc.getAnnotatedElementFactory(); // Clear AnnotatedElementFactory caches annotatedElementFactory.clear(); AnnotatedType annotatedType = annotatedElementFactory.newAnnotatedType(bean.getBeanClass()); ReflectionHelper.set(bean, InjectionTargetBean.class, "annotatedType", annotatedType); // Updated members that were set by bean attributes BeanAttributesImpl attributes = BeanAttributesBuilder.forContext(wbc).newBeanAttibutes(annotatedType).build(); ReflectionHelper.set(bean, BeanAttributesImpl.class, "types", attributes.getTypes()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "qualifiers", attributes.getQualifiers()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "scope", attributes.getScope()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "name", attributes.getName()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "stereotypes", attributes.getStereotypes()); ReflectionHelper.set(bean, BeanAttributesImpl.class, "alternative", attributes.isAlternative()); InjectionTargetFactory factory = new InjectionTargetFactoryImpl(annotatedType, bean.getWebBeansContext()); InjectionTarget injectionTarget = factory.createInjectionTarget(bean); ReflectionHelper.set(bean, InjectionTargetBean.class, "injectionTarget", injectionTarget); LOGGER.debug("New annotated type created for bean '{}'", bean.getBeanClass()); }
public OpenEJBBeanBuilder(final BeanContext bc, final WebBeansContext webBeansContext, final AnnotatedType<A> annotatedType) { super(webBeansContext, annotatedType, BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build()); this.beanContext = bc; }
@Override public <U extends T> BeanConfigurator<U> read(AnnotatedType<U> type) { read(BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(type).build()); return (BeanConfigurator<U>) this; }