Examples of InjectionPoint


Examples of javax.enterprise.inject.spi.InjectionPoint

        AnnotatedElementFactory annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
        AnnotatedType<?> annotated = annotatedElementFactory.newAnnotatedType(member.getDeclaringClass());
        AnnotatedMethod method = annotatedElementFactory.newAnnotatedMethod(member, annotated);
        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

Examples of javax.enterprise.inject.spi.InjectionPoint

        if (scannerService.isBDABeansXmlScanningEnabled())
        {
            if (injectinPointClass == null)
            {
                // Retrieve ip from thread local for producer case
                InjectionPoint ip = injectionPoints.get();
                if (ip != null)
                {
                    injectinPointClass = ip.getBean().getBeanClass();
                }
            }
            bdaBeansXMLFilePath = getBDABeansXMLPath(injectinPointClass);
        }
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

        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

Examples of javax.enterprise.inject.spi.InjectionPoint

        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);
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

        AnnotatedType<Object> annotated = (AnnotatedType<Object>) webBeansContext.getAnnotatedElementFactory().newAnnotatedType(member.getDeclaringClass());
        AnnotatedConstructor constructor = webBeansContext.getAnnotatedElementFactory().newAnnotatedConstructor((Constructor<Object>)member,annotated);
        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);
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

    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");
        }
       
        if(!(ipFound.getMember() instanceof Constructor))
        {
            AnnotatedElement element = (AnnotatedElement)ipFound.getMember();
            if(!element.isAnnotationPresent(Inject.class))
            {
                String message = "Error in decorator : "+ toString() + ". The delegate injection point must be an injected field, " +
                        "initializer method parameter or bean constructor method parameter.";
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

        }
    }

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

Examples of javax.enterprise.inject.spi.InjectionPoint

        Set<Type> types = new LinkedHashSet<Type>();
        types.add(ILog.class);
       
        Decorator<?> decorator = getBeanManager().resolveDecorators(types, new Annotation[0]).iterator().next();
        InjectionPoint injectionPoint = decorator.getInjectionPoints().iterator().next();
       
        //Check that injection point is delegate
        Assert.assertTrue(injectionPoint.isDelegate());
       
        Bean<?> bean = getBeanManager().getBeans("org.apache.webbeans.newtests.decorators.simple.MyLog").iterator().next();
       
        ILog ilog = (ILog) getBeanManager().getReference(bean, ILog.class, getBeanManager().createCreationalContext(bean));
        ilog.log("DELEGATE TEST");
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

    @Override
    public InjectionPoint create(CreationalContextImpl<InjectionPoint> env,
                                 CreationalContextImpl<?> parentEnv,
                                 InjectionPoint ip)
    {
      InjectionPoint ip2 =  parentEnv.findInjectionPoint();
     
      if (ip2 != null)
        return ip2;
     
      throw new InjectionException(L.l("no injection point available in this context {0}",
View Full Code Here

Examples of javax.enterprise.inject.spi.InjectionPoint

                   
                    //Annotated parameter
                    AnnotatedParameter<T> annotatedParameter = annotatedMethod.getParameters().get(i);
                   
                    //Creating injection point
                    InjectionPoint point = InjectionPointFactory.getPartialInjectionPoint(this.bean, type, this.observerMethod, annotatedParameter, bindingTypes);
                   
                    //Injected Bean
                    Bean<Object> injectedBean = (Bean<Object>)InjectionResolver.getInstance().getInjectionPointBean(point);
                   
                    //Set for @Inject InjectionPoint
                    if(WebBeansUtil.isDependent(injectedBean))
                    {
                        if(!InjectionPoint.class.isAssignableFrom(ClassUtil.getClass(point.getType())))
                        {
                            InjectionPointBean.local.set(point);  
                        }
                    }                          
                   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.