本文整理汇总了Java中javax.jdo.metadata.JDOMetadata.newPackageMetadata方法的典型用法代码示例。如果您正苦于以下问题:Java JDOMetadata.newPackageMetadata方法的具体用法?Java JDOMetadata.newPackageMetadata怎么用?Java JDOMetadata.newPackageMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jdo.metadata.JDOMetadata
的用法示例。
在下文中一共展示了JDOMetadata.newPackageMetadata方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPackageMetadata
import javax.jdo.metadata.JDOMetadata; //导入方法依赖的package包/类
private static PackageMetadata getPackageMetadata(JDOMetadata jdoMetadata, String packageName) {
// first look for existing metadata
PackageMetadata[] packages = jdoMetadata.getPackages();
if (ArrayUtils.isNotEmpty(packages)) {
for (PackageMetadata pkgMetadata : packages) {
if (StringUtils.equals(pkgMetadata.getName(), packageName)) {
return pkgMetadata;
}
}
}
// if not found, create new
return jdoMetadata.newPackageMetadata(packageName);
}
示例2: populate
import javax.jdo.metadata.JDOMetadata; //导入方法依赖的package包/类
public JDOMetadata populate(JDOMetadata md, String fullyQualifiedClassName, String fieldName) {
PackageMetadata pmd = md.newPackageMetadata(fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf(".")));
ClassMetadata cmd = pmd.newClassMetadata(fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf(".") + 1));
cmd.setTable(new ClassName(fullyQualifiedClassName).getSimpleName().toLowerCase()).setDetachable(true);
cmd.setPersistenceModifier(ClassPersistenceModifier.PERSISTENCE_CAPABLE);
cmd.setIdentityType(IdentityType.APPLICATION);
cmd.newDatastoreIdentityMetadata().setStrategy(IdGeneratorStrategy.INCREMENT);
cmd.newInheritanceMetadata().setStrategy(InheritanceStrategy.NEW_TABLE);
FieldMetadata fmd = cmd.newFieldMetadata(fieldName);
fmd.setNullValue(NullValue.DEFAULT).setColumn(fieldName);
return md;
}
示例3: populate
import javax.jdo.metadata.JDOMetadata; //导入方法依赖的package包/类
public JDOMetadata populate(JDOMetadata md, String fullyQualifiedClassName, String fieldName) {
String packageName = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf("."));
PackageMetadata pmd = md.newPackageMetadata(packageName);
String className = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf(".") + 1);
ClassMetadata cmd = pmd.newClassMetadata(className);
cmd.setTable(className.toUpperCase()).setDetachable(true);
cmd.setIdentityType(IdentityType.DATASTORE);
cmd.setPersistenceModifier(ClassPersistenceModifier.PERSISTENCE_CAPABLE);
FieldMetadata fmd = cmd.newFieldMetadata(fieldName);
fmd.setNullValue(NullValue.DEFAULT).setColumn(fieldName);
return md;
}