Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.Bean


        beanSet = webBeans.getBeans(destinationType);

      Object destComp = null;

      if (beanSet.size() > 0) {
        Bean destBean = webBeans.resolve(beanSet);
        CreationalContext env = webBeans.createCreationalContext(destBean);

        destComp
          = webBeans.getReference(destBean, destBean.getBeanClass(), env);
      }

      if (destComp == null)
        throw new ConfigException(L.l("{0}: '{1}' is an unknown destination type '{2}'",
                                      loc,
                                      _destinationName,
                                      _destinationType.getName()));

      bean.setDestinationValue((Destination) destComp);

      beanSet = webBeans.getBeans(ConnectionFactory.class);

      Bean factoryBean = webBeans.resolve(beanSet);
      CreationalContext env = webBeans.createCreationalContext(factoryBean);

      Object comp = webBeans.getReference(factoryBean);

      if (comp == null)
View Full Code Here


            return;
        }

        for (Map.Entry<Class<?>, Class<? extends Annotation>> partialBeanEntry : this.partialBeans.entrySet())
        {
            Bean partialBean = createPartialBean(
                    partialBeanEntry.getKey(), partialBeanEntry.getValue(), afterBeanDiscovery, beanManager);

            if (partialBean != null)
            {
                afterBeanDiscovery.addBean(partialBean);
View Full Code Here

            return;
        }

        for (Class<?> originalClass : this.classesToProxy)
        {
            Bean bean = createBean(originalClass, beanManager);

            if (bean != null)
            {
                afterBeanDiscovery.addBean(bean);
            }
View Full Code Here

    @Dependent
    @NamedTypedMessageBundle
    @SuppressWarnings("UnusedDeclaration")
    Object produceTypedMessageBundle(NamedMessageBundleInvocationHandler handler)
    {
        Bean currentMessageBundleContextBean = MessageBundleContext.getCurrentMessageBundleBean();
        Class<?> type = extractCustomType(currentMessageBundleContextBean);
        handler.setTargetType(type);
        return createMessageBundleProxy(type, handler);
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        StartMain startMain = new StartMain(new String[0]);
        beanManager = startMain.go().getBeanManager();
       
        final Bean pathsBean = (Bean) beanManager.getBeans( Paths.class ).iterator().next();
        final CreationalContext cc = beanManager.createCreationalContext( pathsBean );
        paths = (Paths) beanManager.getReference( pathsBean,
                                                  Paths.class,
                                                  cc );
       
View Full Code Here

    }
   
    @Test
    @Ignore //TODO {porcelli} have no idea why weld can't start container =/
    public void testCopyAndRenameAndDelete() throws Exception {
        final Bean drlTextEditorServiceBean = (Bean) beanManager.getBeans( DecisionTableXLSService.class ).iterator().next();
        final CreationalContext cc = beanManager.createCreationalContext( drlTextEditorServiceBean );
        final DecisionTableXLSService drlTextEditorService = (DecisionTableXLSService) beanManager.getReference( drlTextEditorServiceBean,
                DecisionTableXLSService.class, cc );
              
        //Copy
View Full Code Here

        BeanManager bm = getBeanManager();
        Set<Bean<?>> beans  = bm.getBeans(name);
        if (beans.isEmpty()) throw new IllegalArgumentException("Bean not found by name: " + name);

        // Get the first bean found for the given name
        Bean bean = beans.iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }
View Full Code Here

                Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
                return type.cast(o);
            }
        }
        // Get the first bean found that implements the given type.
        Bean bean = beans.iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return type.cast(o);
    }
View Full Code Here

        }
    }

    public static Object getBeanByName(String name) {
        BeanManager bm = getBeanManager();
        Bean bean = bm.getBeans(name).iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }
View Full Code Here

        return o;
    }

    public static Object getBeanByType(Class type) {
        BeanManager bm = getBeanManager();
        Bean bean = bm.getBeans(type).iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }   
View Full Code Here

TOP

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

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.