Package jfun.yan

Examples of jfun.yan.Component


    return cc;
  }
  public synchronized java.util.List getComponentsOfType(final Class type){
    final java.util.ArrayList ret = new java.util.ArrayList();
    for(Iterator it=creators.values().iterator();it.hasNext();){
      final Component cci = (Component)it.next();
      final Class typei = cci.getType();
      if(typei!=null &&
          !void.class.equals(typei) && ReflectionUtil.isAssignableFrom(
          type, typei)){
        ret.add(cci);
      }
View Full Code Here


    }
    return ret;
  }
  public synchronized void unregisterComponentsOfType(Class type){
    for(Iterator it=creators.values().iterator();it.hasNext();){
      final Component cci = (Component)it.next();
      final Class typei = cci.getType();
      if(typei!=null && ReflectionUtil.isAssignableFrom(
          type, typei)){
        it.remove();
      }
    }
View Full Code Here

  }
  public synchronized void verify(final ComponentMap cmap) {
    for(Iterator it=creators.keySet().iterator();it.hasNext();){
      final Object ki = it.next();
      try{
        final Component cc = (Component)creators.get(ki);
        cc.verify(cmap.getDependency(ki, cmap));
      }
      catch(YanException e){
        e.push("verify <" + ki +">");
        throw e;
      }
View Full Code Here

            autowire_txman
        ).label("transaction manager auto detection");
    }
    final Class type = c.getType();

    final Component r = createSpringBeanComponent(c, ctxt, transaction_manager, transaction_attributes, interfaces);
    if(type!=null && BeanPostProcessor.class.isAssignableFrom(type)){
      //does bpp suffer from proxies?
      ctxt.addBeanPostProcessor(ctxt.getTagName(), c);
    }
    if(type!=null && FactoryBean.class.isAssignableFrom(type)){
      //for factory bean, we do not know its type in advance.
      return r;
    }
    if(transaction_attributes!=null){
      //for beans to be proxied, we do not know the type.
      return r;
    }
    if(r.getType()==null && type!=null)
      return ctxt.cast(type, r);
    else return r;
  }
View Full Code Here

    final Class type = c.getType();
    if(type!=null && FactoryBean.class.isAssignableFrom(type)){
      return c;
    }
    else{
      final Component fbc = (Component)NutsUtils.getState(c, factory_bean_key);
      return fbc;
    }
  }
View Full Code Here

   * @param key the key of the FactoryBean component. The key doesn't need to be
   * prefixed with a '&' as one has to do in Spring.
   * @return the FactoryBean instance.
   */
  public static FactoryBean getFactoryBean(Container yan, Object key){
    final Component c = yan.getComponent(key);
    if(c==null){
      return null;
    }
    final Component fbc = getFactoryBeanComponent(c);
    if(fbc==null){
      return null;
    }
    return (FactoryBean)yan.instantiateComponent(fbc);
  }
View Full Code Here

    final boolean for_factorybean = isFactoryBeanType(type);
    for(Iterator it=yan.keys().iterator();it.hasNext();){
      final Object key = it.next();
      if(!(key instanceof String)) continue;
      final jfun.yan.Component c = yan.getComponent(key);
      final Component fbc = SpringAdapter.getFactoryBeanComponent(c);
      if(fbc!=null){
        //I am Factory Bean
        if(includeFactoryBeans){
          //attempt to match the FactoryBean result.
          final FactoryBean fb = (FactoryBean)instantiate(fbc);
View Full Code Here

      }
    };
    return result;
  }
  private Component findComponent(String name){
    final Component c = yan.getComponent(name);
    if(c==null){
      throw new NoSuchBeanDefinitionException(name, "bean "+name+" not found.");
    }
    return c;
  }
View Full Code Here

   */
  public Object getBean(final String beanname, Class requiredType) throws BeansException {
    if(BeanFactoryUtils.isFactoryDereference(beanname)){
      //return FactoryBean
      final String factoryname = BeanFactoryUtils.transformedBeanName(beanname);
      final Component c = findComponent(factoryname);
      final Component fbc = SpringAdapter.getFactoryBeanComponent(c);
      if(fbc!=null){
        throw new NoSuchBeanDefinitionException(beanname,
            "FactoryBean "+factoryname+" not found.");
      }
      final Object result = instantiate(fbc);
      checkBeanInstanceType(beanname, requiredType, result);
      return result;
    }
    else{
      final Component c = findComponent(beanname);
      final Component fbc = SpringAdapter.getFactoryBeanComponent(c);
      if(requiredType==null){
        return instantiate(c);
      }
      if(fbc!=null){
        final FactoryBean fb = (FactoryBean)instantiate(fbc);
View Full Code Here

   * FactoryBean is instantiated if the name doesn't start with '&'
   * and the bean is a FactoryBean.
   */
  public boolean isSingleton(final String name)
  throws NoSuchBeanDefinitionException {
    final Component c = getComponent(name);
    if(!BeanFactoryUtils.isFactoryDereference(name)){
      final Component fbc = SpringAdapter.getFactoryBeanComponent(c);
      if(fbc!=null){
        final FactoryBean fb = (FactoryBean)instantiate(fbc);
        return fb.isSingleton();
      }
    }
View Full Code Here

TOP

Related Classes of jfun.yan.Component

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.