Package org.nutz.ioc.annotation

Examples of org.nutz.ioc.annotation.InjectName


    }
    return new IocLoading(supportedTypes);
  }

  public <T> T get(Class<T> type) throws IocException {
    InjectName inm = type.getAnnotation(InjectName.class);
    if (null != inm && (!Strings.isBlank(inm.value())))
      return get(type, inm.value());
    return get(type, Strings.lowerFirst(type.getSimpleName()));
  }
View Full Code Here


      // 采用 @IocBean->name
      String beanName = iocBean.name();
      if (Strings.isBlank(beanName)) {
        // 否则采用 @InjectName
        InjectName innm = classZ.getAnnotation(InjectName.class);
        if (null != innm && !Strings.isBlank(innm.value())) {
          beanName = innm.value();
        }
        // 大哥(姐),您都不设啊!? 那就用 simpleName 吧
        else {
          beanName = Strings.lowerFirst(classZ.getSimpleName());
        }
View Full Code Here

 
  public static void evalModule(ActionInfo ai, Class<?> type) {
    ai.setModuleType(type);
    String beanName = null;
    // 按照5.10.3章节的说明,优先使用IocBean.name的注解声明bean的名字 Modify By QinerG@gmai.com
    InjectName innm = type.getAnnotation(InjectName.class);
    IocBean iocBean = type.getAnnotation(IocBean.class);
    if (innm == null && iocBean == null) // TODO 再考虑考虑
      return;
    if (iocBean != null) {
      beanName = iocBean.name();
    }
    if (Strings.isBlank(beanName)) {
      if (innm != null && !Strings.isBlank(innm.value())) {
        beanName = innm.value();
      } else {
        beanName = Strings.lowerFirst(type.getSimpleName());
      }
    }
    ai.setInjectName(beanName);
View Full Code Here

        }
        return new IocLoading(supportedTypes);
    }

    public <T> T get(Class<T> type) throws IocException {
        InjectName inm = type.getAnnotation(InjectName.class);
        if (null != inm && (!Strings.isBlank(inm.value())))
            return get(type, inm.value());
        return get(type, Strings.lowerFirst(type.getSimpleName()));
    }
View Full Code Here

            // 采用 @IocBean->name
            String beanName = iocBean.name();
            if (Strings.isBlank(beanName)) {
                // 否则采用 @InjectName
                InjectName innm = classZ.getAnnotation(InjectName.class);
                if (null != innm && !Strings.isBlank(innm.value())) {
                    beanName = innm.value();
                }
                // 大哥(姐),您都不设啊!? 那就用 simpleName 吧
                else {
                    beanName = Strings.lowerFirst(classZ.getSimpleName());
                }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Override
    public <T> T get(Class<T> classZ) throws IocException {
        InjectName injectName = classZ.getAnnotation(InjectName.class);
        if (injectName != null && !Strings.isBlank(injectName.value()))
            return (T) applicationContext.getBean(injectName.value());
        return (T) applicationContext.getBean(applicationContext.getBeanNamesForType(classZ)[0]);
    }
View Full Code Here

            // 采用 @IocBean->name
            String beanName = iocBean.name();
            if (Strings.isBlank(beanName)) {
                // 否则采用 @InjectName
                InjectName innm = classZ.getAnnotation(InjectName.class);
                if (null != innm && !Strings.isBlank(innm.value())) {
                    beanName = innm.value();
                }
                // 大哥(姐),您都不设啊!? 那就用 simpleName 吧
                else {
                    beanName = Strings.lowerFirst(classZ.getSimpleName());
                }
View Full Code Here

        }
        return new IocLoading(supportedTypes);
    }

    public <T> T get(Class<T> type) throws IocException {
        InjectName inm = type.getAnnotation(InjectName.class);
        if (null != inm && (!Strings.isBlank(inm.value())))
            return get(type, inm.value());
        IocBean iocBean = type.getAnnotation(IocBean.class);
        if (iocBean != null && (!Strings.isBlank(iocBean.name())))
          return get(type, iocBean.name());
        return get(type, Strings.lowerFirst(type.getSimpleName()));
    }
View Full Code Here

    public static void evalModule(ActionInfo ai, Class<?> type) {
        ai.setModuleType(type);
        String beanName = null;
        // 按照5.10.3章节的说明,优先使用IocBean.name的注解声明bean的名字 Modify By QinerG@gmai.com
        InjectName innm = type.getAnnotation(InjectName.class);
        IocBean iocBean = type.getAnnotation(IocBean.class);
        if (innm == null && iocBean == null) // TODO 再考虑考虑
            return;
        if (iocBean != null) {
            beanName = iocBean.name();
        }
        if (Strings.isBlank(beanName)) {
            if (innm != null && !Strings.isBlank(innm.value())) {
                beanName = innm.value();
            } else {
                beanName = Strings.lowerFirst(type.getSimpleName());
            }
        }
        ai.setInjectName(beanName);
View Full Code Here

TOP

Related Classes of org.nutz.ioc.annotation.InjectName

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.