本文整理匯總了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();
}
}