public BeanAttributes<T> getBeanAttributes() { // make sure we always have an @Any Qualifier as well. qualifiers.add(AnyLiteral.INSTANCE); return new BeanAttributesImpl<>(types, qualifiers, scope, name, false, stereotypes, alternative); } }
return new JmsBean<>(webBeansContext, model, new BeanAttributesImpl<>(apiTypes, qualifiers));
protected BuiltInOwbBean( WebBeansContext webBeansContext, WebBeansType webBeansType, BeanAttributesImpl<T> beanAttributes, Class<T> returnType, boolean nullable, ProducerFactory<T> producerFactory) { super(webBeansContext, webBeansType, beanAttributes, returnType, nullable); Asserts.assertNotNull(producerFactory, "ProducerFactory"); producer = producerFactory.createProducer(this); }
public InjectionPointBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.INJECTIONPOINT, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(InjectionPoint.class, Object.class)), InjectionPoint.class, false, new SimpleProducerFactory<>(new InjectionPointProducer())); }
public InterceptionFactoryBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.INTERCEPTIONFACTORY, new BeanAttributesImpl<>( CollectionUtil.<Type>unmodifiableSet(InterceptionFactory.class, Object.class), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET), InterceptionFactory.class, false, new SimpleProducerFactory<>(new InterceptionFactoryProducer(webBeansContext))); }
public RequestContextControllerBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.MANAGER, new BeanAttributesImpl<>(CollectionUtil.unmodifiableSet(RequestContextController.class, Object.class), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET), RequestContextController.class, false, new SimpleProducerFactory<>(new RequestContextControllerProducer(webBeansContext))); }
public EventMetadataBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.METADATA, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(EventMetadata.class, Object.class)), EventMetadata.class, false, new SimpleProducerFactory<>(new EventMetadataProducer())); }
public BeanManagerBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.MANAGER, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(BeanManager.class, Object.class), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET), BeanManager.class, false, new SimpleProducerFactory<>(new BeanManagerProducer(webBeansContext))); }
@SuppressWarnings("serial") public InterceptorMetadataBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.METADATA, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(Interceptor.class, Object.class)), new TypeLiteral<Interceptor<T>>(){}.getRawType(), false, new SimpleProducerFactory<>(new MetadataProducer<Interceptor<T>>())); }
@SuppressWarnings("serial") public InstanceBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.INSTANCE, new BeanAttributesImpl(CollectionUtil.unmodifiableSet(Instance.class, Provider.class, Object.class)), new TypeLiteral<Instance<T>>(){}.getRawType(), false, new SimpleProducerFactory(new InstanceProducer(webBeansContext))); }
@SuppressWarnings("serial") public DecoratorMetadataBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.METADATA, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(Decorator.class, Object.class)), new TypeLiteral<Decorator<T>>(){}.getRawType(), false, new SimpleProducerFactory<>(new MetadataProducer<Decorator<T>>())); }
@SuppressWarnings("serial") public BeanMetadataBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.METADATA, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(Bean.class, Contextual.class, Object.class)), new TypeLiteral<Bean<T>>(){}.getRawType(), false, new SimpleProducerFactory<>(new MetadataProducer<Bean<T>>())); }
@SuppressWarnings("serial") public InterceptedOrDecoratedBeanMetadataBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.METADATA, new BeanAttributesImpl<>( CollectionUtil.<Type>unmodifiableSet(Bean.class, Contextual.class, Object.class), CollectionUtil.<Annotation>unmodifiableSet(new AnnotationLiteral<Intercepted>() { }, new AnnotationLiteral<Decorated>() { })), new TypeLiteral<Bean<T>>(){}.getRawType(), false, new SimpleProducerFactory<>(new BeanMetadataProducer<Bean<T>>())); }
/** * Default constructor. * @param webBeansContext */ public ConversationBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.CONVERSATION, new BeanAttributesImpl<>( CollectionUtil.<Type>unmodifiableSet(Conversation.class, ConversationImpl.class, Object.class), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET, RequestScoped.class, "javax.enterprise.context.conversation", false, Collections.<Class<? extends Annotation>>emptySet(), false), ConversationImpl.class, false, new SimpleProducerFactory<>( new ConversationProducer(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(ConversationImpl.class), webBeansContext))); setEnabled(true); }
/** * New WebBeans component class. * * @return the new component */ public <T> NewManagedBean<T> createNewComponent(OwbBean<T> bean, Class<T> type) { Asserts.assertNotNull(bean, "bean"); if (!EnumSet.of(WebBeansType.MANAGED, WebBeansType.ENTERPRISE, WebBeansType.PRODUCERMETHOD, WebBeansType.PRODUCERFIELD).contains(bean.getWebBeansType())) { throw new WebBeansConfigurationException("@New annotation on type : " + bean.getBeanClass() + " must defined as a simple or an enterprise web bean"); } AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(type); BeanAttributesImpl<T> newBeanAttributes = new BeanAttributesImpl<>(bean.getTypes(), Collections.<Annotation>singleton(new NewLiteral(type))); NewManagedBean<T> newBean = new NewManagedBean<>(bean.getWebBeansContext(), bean.getWebBeansType(), annotatedType, newBeanAttributes, type, bean.getInjectionPoints()); //TODO XXX set producer return newBean; }
/** * Creates a new instance of event bean. * @param webBeansContext */ @SuppressWarnings("serial") public EventBean(WebBeansContext webBeansContext) { super(webBeansContext, WebBeansType.OBSERVABLE, new BeanAttributesImpl<>(CollectionUtil.<Type>unmodifiableSet(new TypeLiteral<Event<T>>() { }.getRawType(), Object.class)), new TypeLiteral<Event<T>>(){}.getRawType(), false, new SimpleProducerFactory<>(new EventProducer<T>(webBeansContext))); }
/** * Creates a new extesion bean. * * @param returnType return type * @param webBeansContext */ public ExtensionBean(WebBeansContext webBeansContext, Class<T> returnType) { super(webBeansContext, WebBeansType.EXTENSION, new BeanAttributesImpl<>( webBeansContext.getAnnotatedElementFactory().getAnnotatedType(returnType).getTypeClosure(), AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION_SET, ApplicationScoped.class), returnType, false, new ExtensionProducerFactory<>(webBeansContext.getAnnotatedElementFactory().getAnnotatedType(returnType), webBeansContext)); }
public BeanAttributesImpl<T> build() { // we need to check the stereotypes first because we might need it to determine the scope stereotypes = defineStereotypes(annotated); defineScope(); if (scope == null) { // this indicates that we shall not use this AnnotatedType to create Beans from it. return null; } defineTypes(); defineName(); defineQualifiers(); defineNullable(); defineAlternative(); return new BeanAttributesImpl<>(types, qualifiers, scope, name, nullable, stereotypes, alternative); }
public NewCdiEjbBean(final CdiEjbBean<T> that) { super(that.getBeanContext(), that.getWebBeansContext(), that.getBeanContext().getManagedClass(), that.getAnnotatedType(), new NewEjbInjectionTargetFactory<T>(that.getAnnotatedType(), that.getWebBeansContext(), that.getInjectionTarget()), new BeanAttributesImpl<T>(that)); this.id = that.getId() + "NewBean"; initInternals(); }
public <T> Bean<T> createNewComponent(Class<T> type) { Asserts.nullCheckForClass(type); OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin(); if (ejbPlugin != null && ejbPlugin.isNewSessionBean(type)) { return ejbPlugin.defineNewSessionBean(type); } AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(type); BeanAttributesImpl<T> defaultBeanAttributes = BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(annotatedType).build(); BeanAttributesImpl<T> newBeanAttributes = new BeanAttributesImpl<>(defaultBeanAttributes.getTypes(), Collections.<Annotation>singleton(new NewLiteral(type))); // TODO replace this by InjectionPointBuilder ManagedBeanBuilder<T, ManagedBean<T>> beanBuilder = new ManagedBeanBuilder<>(webBeansContext, annotatedType, newBeanAttributes, false); NewManagedBean<T> newBean = new NewManagedBean<>(webBeansContext, WebBeansType.MANAGED, annotatedType, newBeanAttributes, type, beanBuilder.getBean().getInjectionPoints()); return newBean; }