Examples of NutMappingField


Examples of org.nutz.dao.impl.entity.field.NutMappingField

      }

      // 是实体字段
      Object value = entry.getValue();
      Mirror<?> mirror = Mirror.me(value);
      NutMappingField ef = new NutMappingField(en);

      if (key.startsWith("+")) {
        ef.setAsAutoIncreasement();
        key = key.substring(1);
      }
      if (key.startsWith("!")) {
        ef.setAsNotNull();
        key = key.substring(1);
      }
      if (key.startsWith("*")) {
        key = key.substring(1);
        if (mirror != null && mirror.isIntLike())
          ef.setAsId();
        else
          ef.setAsName();
      }
      ef.setName(key);

      ef.setType(null == value ? Object.class : value.getClass());
      ef.setColumnName(key);

      // 猜测一下数据库类型
      Jdbcs.guessEntityFieldColumnType(ef);
      ef.setAdaptor(support.expert.getAdaptor(ef));
      if(mirror != null)
        ef.setType(mirror.getType());
      ef.setInjecting(new InjectToMap(key));
      ef.setEjecting(new EjectFromMap(key));

      en.addMappingField(ef);
    }
    en.checkCompositeFields(null);

View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

    /*
     * 解析所有映射字段
     */
    for (MappingInfo info : infos) {
      NutMappingField ef = new NutMappingField(en);
      _evalMappingField(ef, info);
      en.addMappingField(ef);
    }
    holder.set(en); // 保存一下,这样别的实体映射到这里时会用的到
    /*
 
View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

        /*
         * 解析所有映射字段
         */
        for (MappingInfo info : infos) {
            NutMappingField ef = new NutMappingField(en);
            _evalMappingField(ef, info);
            en.addMappingField(ef);
        }
        holder.set(en); // 保存一下,这样别的实体映射到这里时会用的到
        /*
 
View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

            }

            // 是实体字段
            Object value = entry.getValue();
            Mirror<?> mirror = Mirror.me(value);
            NutMappingField ef = new NutMappingField(en);

            if (key.startsWith("+")) {
                ef.setAsAutoIncreasement();
                key = key.substring(1);
            }
            if (key.startsWith("!")) {
                ef.setAsNotNull();
                key = key.substring(1);
            }
            if (key.startsWith("*")) {
                key = key.substring(1);
                if (mirror != null && mirror.isIntLike())
                    ef.setAsId();
                else
                    ef.setAsName();
            }
            ef.setName(key);

            ef.setType(null == value ? Object.class : value.getClass());
            ef.setColumnName(key);

            // 猜测一下数据库类型
            Jdbcs.guessEntityFieldColumnType(ef);
            ef.setAdaptor(support.expert.getAdaptor(ef));
            if (mirror != null)
                ef.setType(mirror.getType());
            ef.setInjecting(new InjectToMap(key));
            ef.setEjecting(new EjectFromMap(key));

            en.addMappingField(ef);
        }
        en.checkCompositeFields(null);

View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

    en.setViewName(tableName);
    Mirror mirror = Mirror.me(en.getType());
   
    Element pkElement = Xmls.firstChild(klassElement, "^id$");
    if (pkElement != null) {
      NutMappingField pk = ele2FieldMapping(en, pkElement);
      if (Mirror.me(mirror.getField(pk.getName()).getType()).isNumber()) {
        pk.setAsId();
      } else {
        pk.setAsName();
      }
      en.addMappingField(pk);
    }
    for (Element prop : Xmls.children(klassElement, "^property$")) {
      en.addMappingField(ele2FieldMapping(en, prop));
View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

    }
    entites.put(en.getType(), en);
  }
 
  public NutMappingField ele2FieldMapping(NutEntity en, Element ele) {
    NutMappingField mappingField = new NutMappingField(en);
    String name = ele.getAttribute("name");
    if (Strings.isBlank(name)) {
      throw new DaoException("blank name property " + en.getType());
    }
    mappingField.setName(name);
    if (ele.hasAttribute("column")) {
      mappingField.setColumnName(ele.getAttribute("column"));
    } else {
      mappingField.setColumnName(name);
    }
   
    if (ele.hasAttribute("type")) {
      // TODO 支持type
    }
   
    if (ele.hasAttribute("length")) {
      mappingField.setWidth(Integer.parseInt(ele.getAttribute("length")));
    }
   
    return mappingField;
  }
View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

            }

            // 是实体字段
            Object value = entry.getValue();
            Mirror<?> mirror = Mirror.me(value);
            NutMappingField ef = new NutMappingField(en);

            if (key.startsWith("+")) {
                ef.setAsAutoIncreasement();
                key = key.substring(1);
            }
            if (key.startsWith("!")) {
                ef.setAsNotNull();
                key = key.substring(1);
            }
            if (key.startsWith("*")) {
                key = key.substring(1);
                if (mirror != null && mirror.isIntLike())
                    ef.setAsId();
                else
                    ef.setAsName();
            }
            ef.setName(key);

            ef.setType(null == value ? Object.class : value.getClass());
            ef.setColumnName(key);

            // 猜测一下数据库类型
            Jdbcs.guessEntityFieldColumnType(ef);
            ef.setAdaptor(support.expert.getAdaptor(ef));
            if (mirror != null)
                ef.setType(mirror.getType());
            ef.setInjecting(new InjectToMap(key));
            ef.setEjecting(new EjectFromMap(key));

            en.addMappingField(ef);
        }
        en.checkCompositeFields(null);

View Full Code Here

Examples of org.nutz.dao.impl.entity.field.NutMappingField

        /*
         * 解析所有映射字段
         */
        for (MappingInfo info : infos) {
            NutMappingField ef = new NutMappingField(en);
            _evalMappingField(ef, info);
            en.addMappingField(ef);
        }
        holder.set(en); // 保存一下,这样别的实体映射到这里时会用的到
        try {
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.