}
}
public EntityType getEntityType(Class<?> entityClass) {
String className = entityClass.getName();
EntityType type = entityTypes.get(className);
if (null != type) { return type; }
type = classEntityTypes.get(className);
if (null == type) {
List<EntityType> matched = CollectUtils.newArrayList();
for (EntityType entityType : entityTypes.values()) {
if (className.equals(entityType.getEntityName())
|| className.equals(entityType.getEntityClass().getName())) {
matched.add(entityType);
}
}
if (matched.size() > 1) { throw new RuntimeException("multi-entityName for class:" + className); }
if (matched.isEmpty()) {
EntityType tmp = new EntityType(entityClass);
classEntityTypes.put(className, tmp);
return tmp;
} else {
classEntityTypes.put(className, matched.get(0));
type = (EntityType) matched.get(0);