Examples of Injecting


Examples of org.nutz.lang.inject.Injecting

   */
  public Object inject(Mirror<?> mirror) {
    Object obj = mirror.born();
    for (Entry<String, ObjcetNaviNode> entry : child.entrySet()) {
      ObjcetNaviNode onn = entry.getValue();
      Injecting in = mirror.getInjecting(entry.getKey());
      if (onn.isLeaf()) {
        try {
          ParamConvertor pc = Params.makeParamConvertor(mirror.getField(entry.getKey()).getType());
          in.inject(obj, pc.convert(onn.getValue()));
  //        in.inject(obj, onn.getValue());
        } catch (NoSuchFieldException e) {
          continue;
        }
        continue;
      }
      // 不是叶子结点,不能直接注入
      Mirror<?> fieldMirror;
      try {
        fieldMirror = Mirror.me(mirror.getField(entry.getKey()).getType());
        in.inject(obj, onn.inject(fieldMirror));
      }
      catch (NoSuchFieldException e) {
        continue;//TODO 是不是应该log一下呢?
      }
    }
View Full Code Here

Examples of org.nutz.lang.inject.Injecting

    Object obj = mirror.born();
    Map<String, Object> map = null;
    if (Map.class.isAssignableFrom(refer.getClass()))
      map = (Map<String, Object>) refer;
    for (int i = 0; i < injs.length; i++) {
      Injecting inj = injs[i];
      Object s;
      if (null != map && map.containsKey(names[i]))
        s = map.get(names[i]);
      else
        s = req.getParameter(names[i]);
      if (null == s)
        continue;
      if (s instanceof String && Strings.isBlank((String) s))
        s = null;
      inj.inject(obj, s);
    }
    return obj;
  }
View Full Code Here

Examples of org.nutz.lang.inject.Injecting

        Object obj = mirror.born();
        Map<String, Object> map = null;
        if (Map.class.isAssignableFrom(refer.getClass()))
            map = (Map<String, Object>) refer;
        for (int i = 0; i < injs.length; i++) {
            Injecting inj = injs[i];
            Object s;
            if (null != map && map.containsKey(names[i]))
                s = map.get(names[i]);
            else
                s = req.getParameter(names[i]);
            if (null == s)
                continue;
            if (s instanceof String && Strings.isBlank((String) s))
                s = null;
            inj.inject(obj, s);
        }
        return obj;
    }
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.