Package org.apache.webbeans.annotation

Examples of org.apache.webbeans.annotation.DependentScopeLiteral


    public InjectionPointBean(WebBeansContext webBeansContext)
    {
        super(WebBeansType.INJECTIONPOINT,InjectionPoint.class, webBeansContext);
       
        addQualifier(new DefaultLiteral());
        setImplScopeType(new DependentScopeLiteral());
        addApiType(InjectionPoint.class);
        addApiType(Object.class);
    }
View Full Code Here


        if (!found)
        {
            Set<Class<? extends Annotation>> stereos = component.getStereotypes();
            if (stereos.size() == 0)
            {
                component.setImplScopeType(new DependentScopeLiteral());

                if (allowLazyInit && component instanceof ManagedBean && isPurePojoBean(component.getWebBeansContext(), component.getBeanClass()))
                {
                    // take the bean as Dependent but we could lazily initialize it
                    // because the bean doesn't contains any CDI feature
                    ((ManagedBean) component).setFullInit(false);
                }
            }
            else
            {
                Annotation defined = null;
                Set<Class<? extends Annotation>> anns = component.getStereotypes();
                for (Class<? extends Annotation> stero : anns)
                {
                    boolean containsNormal = AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), NormalScope.class);
                   
                    if (AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), NormalScope.class) ||
                            AnnotationUtil.hasMetaAnnotation(stero.getDeclaredAnnotations(), Scope.class))
                    {                       
                        Annotation next;
                       
                        if(containsNormal)
                        {
                            next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), NormalScope.class)[0];
                        }
                        else
                        {
                            next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), Scope.class)[0];
                        }

                        if (defined == null)
                        {
                            defined = next;
                        }
                        else
                        {
                            if (!defined.equals(next))
                            {
                                throw new WebBeansConfigurationException(exceptionMessage);
                            }
                        }
                    }
                }

                if (defined != null)
                {
                    component.setImplScopeType(defined);
                }
                else
                {
                    component.setImplScopeType(new DependentScopeLiteral());

                    if (allowLazyInit && component instanceof ManagedBean && isPurePojoBean(component.getWebBeansContext(), component.getBeanClass()))
                    {
                        // take the bean as Dependent but we could lazily initialize it
                        // because the bean doesn't contains any CDI feature
View Full Code Here

               
                ResourceBean<T,Annotation> resourceBean = new ResourceBean(returnType,parent, resourceRef);
               
                defineProducerMethodApiTypes(resourceBean, field.getGenericType() , field.getDeclaredAnnotations());
                defineQualifiers(resourceBean, field.getDeclaredAnnotations());
                resourceBean.setImplScopeType(new DependentScopeLiteral());
                resourceBean.setProducerField(field);
               
                return resourceBean;               
            }
        }
View Full Code Here

                       
                        ResourceBean<X,Annotation> resourceBean = new ResourceBean((Class<X>)field.getType(),bean, resourceRef);
                       
                        resourceBean.getTypes().addAll(annotatedField.getTypeClosure());
                        definitionUtil.defineQualifiers(resourceBean, anns);
                        resourceBean.setImplScopeType(new DependentScopeLiteral());
                        resourceBean.setProducerField(field);
                       
                        producerBeans.add(resourceBean);                                           
                    }
                }
View Full Code Here

                //Class of the component
                Class<T> clazz = type.getJavaClass();
               
                //Just creating temporary for getting injected fields
                ManagedBean<T> managedBean = new ManagedBean<T>(clazz,WebBeansType.MANAGED, webBeansContext);
                managedBean.setImplScopeType(new DependentScopeLiteral());
                managedBean.setAnnotatedType(type);
                           
                AnnotatedTypeBeanCreatorImpl<T> managedBeanCreator = new AnnotatedTypeBeanCreatorImpl<T>(managedBean);           
                managedBeanCreator.setAnnotatedType(type);
               
View Full Code Here


        if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
        {
            comp = new NewManagedBean<T>(clazz, WebBeansType.MANAGED, webBeansContext);
            comp.setImplScopeType(new DependentScopeLiteral());
            comp.setConstructor(defineConstructor(clazz));
            definitionUtil.addConstructorInjectionPointMetaData(comp, comp.getConstructor());

            definitionUtil.defineInjectedFields(comp);
            definitionUtil.defineInjectedMethods(comp);
        }
        else if (EJBWebBeansConfigurator.isSessionBean(clazz, webBeansContext))
        {
            comp = new NewManagedBean<T>(clazz, WebBeansType.ENTERPRISE, webBeansContext);
            comp.setImplScopeType(new DependentScopeLiteral());
        }
        else
        {
            throw new WebBeansConfigurationException("@New annotation on type : " + clazz.getName()
                                                     + " must defined as a simple or an enterprise web bean");
View Full Code Here

     */
    public BeanManagerBean getManagerBean()
    {
        BeanManagerBean managerComponent = new BeanManagerBean(webBeansContext);

        managerComponent.setImplScopeType(new DependentScopeLiteral());
        managerComponent.addQualifier(new DefaultLiteral());
        managerComponent.addQualifier(new AnyLiteral());
        managerComponent.addApiType(BeanManager.class);
        managerComponent.addApiType(Object.class);

View Full Code Here

        instanceBean.getTypes().add(INSTANCE_TYPE);
        instanceBean.getTypes().add(PROVIDER_TYPE);
        instanceBean.addApiType(Object.class);

        instanceBean.addQualifier(new AnyLiteral());
        instanceBean.setImplScopeType(new DependentScopeLiteral());
        instanceBean.setName(null);

        return instanceBean;
    }
View Full Code Here

        eventBean.getTypes().add(EVENT_TYPE);
        eventBean.addApiType(Object.class);

        eventBean.addQualifier(new AnyLiteral());
        eventBean.setImplScopeType(new DependentScopeLiteral());
        eventBean.setName(null);

        return eventBean;
    }
View Full Code Here

    public static void defineDefaultScopeType(Component<?> component, String exceptionMessage)
    {
        Set<Annotation> stereos = component.getStereotypes();
        if (stereos.size() == 0)
        {
            component.setImplScopeType(new DependentScopeLiteral());
        }
        else
        {
            Annotation defined = null;
            Set<Annotation> anns = component.getStereotypes();
            for (Annotation stero : anns)
            {
                if (AnnotationUtil.isMetaAnnotationExist(stero.annotationType().getAnnotations(), ScopeType.class))
                {
                    Annotation next = AnnotationUtil.getMetaAnnotations(stero.annotationType().getAnnotations(), ScopeType.class)[0];

                    if (defined == null)
                    {
                        defined = next;
                    }
                    else
                    {
                        if (!defined.equals(next))
                        {
                            throw new WebBeansConfigurationException(exceptionMessage);
                        }
                    }
                }
            }

            if (defined != null)
            {
                component.setImplScopeType(defined);
            }
            else
            {
                component.setImplScopeType(new DependentScopeLiteral());
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.annotation.DependentScopeLiteral

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.