当前位置: 首页>>代码示例>>Java>>正文


Java JDOMetadata.newPackageMetadata方法代码示例

本文整理汇总了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);
}
 
开发者ID:motech,项目名称:motech,代码行数:14,代码来源:EntityMetadataBuilderImpl.java

示例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;
}
 
开发者ID:subhrajitroy,项目名称:osgi-jdo-sample,代码行数:15,代码来源:EntityMetadataFactory.java

示例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;
}
 
开发者ID:subhrajitroy,项目名称:osgi-jdo-sample,代码行数:15,代码来源:ClassMetadataFactory.java


注:本文中的javax.jdo.metadata.JDOMetadata.newPackageMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。