Java 类javax.persistence.metamodel.StaticMetamodel 实例源码
项目:zstack
文件:MysqlQueryBuilderImpl3.java
private void populateEntityInfo() throws NoSuchMethodException {
List<Class> metaClasses = BeanUtils.scanClass("org.zstack", StaticMetamodel.class);
for (Class it : metaClasses) {
StaticMetamodel at = (StaticMetamodel) it.getAnnotation(StaticMetamodel.class);
metaModelClasses.put(at.value(), it);
}
List<Class> invClasses = BeanUtils.scanClass("org.zstack", Inventory.class);
for (Class invClass : invClasses) {
EntityInfo info = buildEntityInfo(invClass);
if (info.inventoryAnnotation.parent().length > 0) {
Parent pat = info.inventoryAnnotation.parent()[0];
Class pinvClass = pat.inventoryClass();
DebugUtils.Assert(pinvClass.isAnnotationPresent(Inventory.class), String.format("inventory[%s]'s parent inventory class[%s] is not annotated by @Inventory", info.inventoryClass.getName(), pinvClass.getName()));
EntityInfo pinfo = buildEntityInfo(pinvClass);
info.parent = pinfo;
pinfo.children.add(info);
}
}
for (EntityInfo e : entityInfos.values()) {
e.buildFlatTypeEntityMap();
}
}