Package org.beangle.model.entity.types

Examples of org.beangle.model.entity.types.EntityType.newInstance()


      EntityType entityType = (EntityType) entityTypes.get(alias);
      if (null == entityType) {
        logger.error("Not register entity type for {}", alias);
        throw new RuntimeException("Not register entity type for " + alias);
      } else {
        entity = entityType.newInstance();
        current.put(alias, entity);
        return entity;
      }
    }
    return entity;
View Full Code Here


      if (StringUtils.isBlank(attrs[i])) {
        continue;
      }
      try {
        EntityType entityType = getEntityType(attrs[i]);
        Entity<?> example = (Entity<?>) entityType.newInstance();
        String entityName = entityType.getEntityName();
        String attr = processAttr(attrs[i]);
        if (attr.indexOf('.') > -1) {
          populator.initProperty(example, entityName, StringUtils.substringBeforeLast(attr, "."));
        }
View Full Code Here

    if (clazz.isInterface()) {
      type = Model.getEntityType(clazz.getName());
    } else {
      type = Model.getEntityType(clazz);
    }
    return (T) populate(type.newInstance(), type.getEntityName(), name);
  }

  @SuppressWarnings("unchecked")
  public static <T> T populate(Class<T> clazz) {
    EntityType type = null;
View Full Code Here

      type = Model.getEntityType(clazz.getName());
    } else {
      type = Model.getEntityType(clazz);
    }
    String entityName = type.getEntityName();
    return (T) populate(type.newInstance(), entityName, EntityUtils.getCommandName(entityName));
  }

  public static Object populate(String entityName) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), EntityUtils.getCommandName(entityName));
View Full Code Here

    return (T) populate(type.newInstance(), entityName, EntityUtils.getCommandName(entityName));
  }

  public static Object populate(String entityName) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), EntityUtils.getCommandName(entityName));
  }

  public static Object populate(String entityName, String name) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), name);
View Full Code Here

    return populate(type.newInstance(), type.getEntityName(), EntityUtils.getCommandName(entityName));
  }

  public static Object populate(String entityName, String name) {
    EntityType type = Model.getEntityType(entityName);
    return populate(type.newInstance(), type.getEntityName(), name);
  }

  public static Object populate(Object obj, String entityName, String name) {
    Map<String, Object> params = Params.sub(name);
    return Model.getPopulator().populate(obj, entityName, params);
View Full Code Here

    }
  }

  public Object populate(Class<?> entityClass, Map<String, Object> params) {
    EntityType entityType = Model.getEntityType(entityClass);
    return populate(entityType.newInstance(), entityType.getEntityName(), params);
  }

  /**
   * 将params中的属性([attr(string)->value(object)],放入到实体类中。<br>
   * 如果引用到了别的实体,那么<br>
 
View Full Code Here

    Long entityId = getEntityId(name);
    Entity<?> entity = null;
    try {
      EntityType type = Model.getEntityType(entityName);
      if (null == entityId) {
        entity = (Entity<?>) populate(type.newInstance(), type.getEntityName(), name);
      } else {
        entity = getModel(entityName, entityId);
      }
    } catch (Exception e) {
      throw new RuntimeException(e.getMessage());
View Full Code Here

    }
  }

  public Object populate(Class<?> entityClass, Map<String, Object> params) {
    EntityType entityType = Model.getEntityType(entityClass);
    return populate(entityType.newInstance(), entityType.getEntityName(), params);
  }

  /**
   * 将params中的属性([attr(string)->value(object)],放入到实体类中。<br>
   * 如果引用到了别的实体,那么<br>
 
View Full Code Here

      EntityType entityType = (EntityType) entityTypes.get(alias);
      if (null == entityType) {
        logger.error("Not register entity type for {}", alias);
        throw new RuntimeException("Not register entity type for " + alias);
      } else {
        entity = entityType.newInstance();
        current.put(alias, entity);
        return entity;
      }
    }
    return entity;
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.