Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.InjectionPoint


        List<InjectionPoint> lists = new ArrayList<InjectionPoint>();

        AnnotatedMethod method = AnnotatedElementFactory.newAnnotatedMethod(member, member.getDeclaringClass());
        List<AnnotatedParameter<?>> parameters = method.getParameters();
       
        InjectionPoint point = null;
       
        for(AnnotatedParameter<?> parameter : parameters)
        {
            //@Observes is not injection point type for method parameters
            if(parameter.getAnnotation(Observes.class) == null)
View Full Code Here


        List<InjectionPoint> lists = new ArrayList<InjectionPoint>();

        List<AnnotatedParameter<X>> parameters = method.getParameters();
       
        InjectionPoint point = null;
       
        for(AnnotatedParameter<?> parameter : parameters)
        {
            //@Observes is not injection point type for method parameters
            if(parameter.getAnnotation(Observes.class) == null)
View Full Code Here

        List<InjectionPoint> lists = new ArrayList<InjectionPoint>();

        List<AnnotatedParameter<T>> parameters = constructor.getParameters();
       
        InjectionPoint point = null;
       
        for(AnnotatedParameter<?> parameter : parameters)
        {
            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), constructor.getJavaMember() , parameter);
            lists.add(point);
View Full Code Here

        List<InjectionPoint> lists = new ArrayList<InjectionPoint>();

        AnnotatedConstructor constructor = AnnotatedElementFactory.newAnnotatedConstructor(member);
        List<AnnotatedParameter<?>> parameters = constructor.getParameters();
       
        InjectionPoint point = null;
       
        for(AnnotatedParameter<?> parameter : parameters)
        {
            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), member , parameter);
            lists.add(point);
View Full Code Here

    @Override
    protected Event<T> createInstance(CreationalContext<Event<T>> creationalContext)
    {
        Event<T> instance = null;

        InjectionPoint injectionPoint = local.get();
        Type eventType = null;
       
        if(injectionPoint != null)
        {
            Type[] eventActualTypeArgs = new Type[0];
            Type type = injectionPoint.getType();                       
            ParameterizedType pt = (ParameterizedType) type;
            eventActualTypeArgs = pt.getActualTypeArguments();

            //First argument and sole argument is actual Event type
            //Example : Event<MyEvent>
            eventType = eventActualTypeArgs[0];
           
            //Event qualifiers
            Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
            qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
           
            try
            {
                instance = new EventImpl<T>(qualifiers, eventType);
            }
View Full Code Here

        }
    }

    public static <T> void addFieldInjectionPointMetaData(AbstractOwbBean<T> owner, Field field)
    {
        InjectionPoint injectionPoint = InjectionPointFactory.getFieldInjectionPointData(owner, field);
        if (injectionPoint != null)
        {
            addImplicitComponentForInjectionPoint(injectionPoint);
            owner.addInjectionPoint(injectionPoint);
        }
View Full Code Here

    protected void initDelegate()
    {
        Set<InjectionPoint> injectionPoints = getInjectionPoints();
        boolean found = false;
        InjectionPoint ipFound = null;
        for(InjectionPoint ip : injectionPoints)
        {
            if(ip.getAnnotated().isAnnotationPresent(Delegate.class))
            {
                if(!found)
                {
                    found = true;
                    ipFound = ip;                   
                }
                else
                {
                    throw new WebBeansConfigurationException("Decorators must have a one @Delegate injection point. " +
                        "But the decorator bean : " + toString() + " has more than one");
                }
            }           
        }
       
       
        if(ipFound == null)
        {
            throw new WebBeansConfigurationException("Decorators must have a one @Delegate injection point." +
                    "But the decorator bean : " + toString() + " has none");
        }
       
        String message = new String("Error in decorator : "+ toString() + ". The delegate injection point must be an injected field, " +
            "initializer method parameter or bean constructor method parameter. ");
       
        if(!(ipFound.getMember() instanceof Constructor))
        {
            AnnotatedElement element = (AnnotatedElement)ipFound.getMember();
            if(!element.isAnnotationPresent(Inject.class))
            {
                throw new WebBeansConfigurationException(message);
            }               
        }
View Full Code Here

                    //Get parameter annotations
                    Annotation[] bindingTypes = AnnotationUtil.getQualifierAnnotations(annot);

                    if (bindingTypes.length > 0)
                    {
                        InjectionPoint point = InjectionPointFactory.getPartialInjectionPoint(null, type, null, null, bindingTypes);
                        @SuppressWarnings("unchecked")
                        Bean<Object> bean = (Bean<Object>)InjectionResolver.getInstance().getInjectionPointBean(point);
                        CreationalContext<Object> creational = manager.createCreationalContext(bean);
                        Object instance = manager.getInstance(bean, creational);
                       
View Full Code Here

    // TODO Esta mudança só deve ser submetida com os testes passando. Esta mudança quebra os testes.
    // Bean<?> bean = getBeanManager().resolve( beans );

    CreationalContext<?> context = getBeanManager().createCreationalContext(bean);
    Type beanType = beanClass == null ? bean.getBeanClass() : beanClass;
    InjectionPoint injectionPoint = new CustomInjectionPoint(bean, beanType, qualifiers);

    return (T) getBeanManager().getInjectableReference(injectionPoint, context);
  }
View Full Code Here

        BeanWithInjectionPointMetadata.reset();

        // Get an instance of the bean which has another bean injected into it
        FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class);
        BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
        InjectionPoint ip = beanWithInjectionPoint.getInjectedMetadata();
        assert ip != null;
        CreationalContext<BeanWithInjectionPointMetadata> creationalContext = getCurrentManager().createCreationalContext(
                (Bean<BeanWithInjectionPointMetadata>) ip.getBean());
        Object beanInstance = getCurrentManager().getInjectableReference(ip, creationalContext);
        assert beanInstance instanceof BeanWithInjectionPointMetadata;

        // The second parameter is an instance of may be used to destroy any object with scope @Dependent that is created
        Bean<BeanWithInjectionPointMetadata> bean = getUniqueBean(BeanWithInjectionPointMetadata.class);
View Full Code Here

TOP

Related Classes of javax.enterprise.inject.spi.InjectionPoint

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.