本文整理汇总了Java中javax.persistence.metamodel.StaticMetamodel类的典型用法代码示例。如果您正苦于以下问题:Java StaticMetamodel类的具体用法?Java StaticMetamodel怎么用?Java StaticMetamodel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StaticMetamodel类属于javax.persistence.metamodel包,在下文中一共展示了StaticMetamodel类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateEntityInfo
import javax.persistence.metamodel.StaticMetamodel; //导入依赖的package包/类
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();
}
}