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


Java Id类代码示例

本文整理汇总了Java中org.seasar.doma.Id的典型用法代码示例。如果您正苦于以下问题:Java Id类的具体用法?Java Id怎么用?Java Id使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Id类属于org.seasar.doma包,在下文中一共展示了Id类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doImportName

import org.seasar.doma.Id; //导入依赖的package包/类
@Override
protected void doImportName(final EntityModel model, final EntityDesc entityDesc) {
    classModelSupport.addImportName(model, Entity.class);
    classModelSupport.addImportName(model, Serializable.class);
    classModelSupport.addImportName(model, Generated.class);
    if (model.getCatalogName() != null || model.getSchemaName() != null
            || model.getTableName() != null) {
        classModelSupport.addImportName(model, Table.class);
    }
    if (superclass != null) {
        classModelSupport.addImportName(model, superclass);
    }
    for (AttributeModel attr : model.getAttributeModelList()) {
        if (attr.isId()) {
            classModelSupport.addImportName(model, Id.class);
            if (attr.getGenerationType() != null) {
                classModelSupport
                        .addImportName(model, GeneratedValue.class);
                classModelSupport
                        .addImportName(model, GenerationType.class);
                if (attr.getGenerationType() == javax.persistence.GenerationType.SEQUENCE) {
                    classModelSupport.addImportName(model,
                            SequenceGenerator.class);
                } else if (attr.getGenerationType() == javax.persistence.GenerationType.TABLE) {
                    classModelSupport.addImportName(model,
                            TableGenerator.class);
                }
            }
        }
        if (attr.isTransient()) {
            classModelSupport.addImportName(model, Transient.class);
        } else {
            classModelSupport.addImportName(model, Column.class);
        }
        if (attr.isVersion()) {
            classModelSupport.addImportName(model, Version.class);
        }
        classModelSupport.addImportName(model, attr.getAttributeClass());
    }
}
 
开发者ID:coastland,项目名称:gsp-dba-maven-plugin,代码行数:41,代码来源:DomaGspFactoryImpl.java

示例2: getSuperclassEntityPropertyInfo

import org.seasar.doma.Id; //导入依赖的package包/类
/**
 * スーパークラスに定義されたエンティティプロパティの情報のセットを返します。
 * 
 * @return スーパークラスに定義されたエンティティプロパティの情報のセット
 * @since 1.7.0
 */
protected Set<EntityPropertyInfo> getSuperclassEntityPropertyInfo() {
    Set<EntityPropertyInfo> results = new HashSet<EntityPropertyInfo>();
    if (superclass == null) {
        return results;
    }
    for (Class<?> clazz = superclass; clazz != Object.class; clazz = clazz
            .getSuperclass()) {
        Entity entity = clazz.getAnnotation(Entity.class);
        if (entity == null) {
            continue;
        }
        org.seasar.doma.jdbc.entity.NamingType namingType = entity.naming();
        for (Field field : clazz.getDeclaredFields()) {
            int m = field.getModifiers();
            if (Modifier.isStatic(m)) {
                continue;
            }
            if (field.isAnnotationPresent(Transient.class)) {
                continue;
            }
            EntityPropertyInfo propertyInfo = new EntityPropertyInfo();
            propertyInfo.entityClass = clazz;
            propertyInfo.propertyField = field;
            Column column = field.getAnnotation(Column.class);
            propertyInfo.column = column;
            if (column == null || column.name().isEmpty()) {
                propertyInfo.columnName = namingType.apply(field.getName())
                        .toLowerCase();
            } else {
                propertyInfo.columnName = column.name();
            }
            propertyInfo.id = field.getAnnotation(Id.class);
            propertyInfo.generatedValue = field
                    .getAnnotation(GeneratedValue.class);
            propertyInfo.sequenceGenerator = field
                    .getAnnotation(SequenceGenerator.class);
            propertyInfo.tableGenerator = field
                    .getAnnotation(TableGenerator.class);
            propertyInfo.version = field.getAnnotation(Version.class);
            results.add(propertyInfo);
        }
    }
    return results;
}
 
开发者ID:domaframework,项目名称:doma-gen,代码行数:51,代码来源:EntityDescFactory.java

示例3: handleImportName

import org.seasar.doma.Id; //导入依赖的package包/类
/**
 * インポート名を処理します。
 * 
 * @param entityDesc
 *            エンティティ記述
 * @param tableMeta
 *            テーブルメタデータ
 */
protected void handleImportName(EntityDesc entityDesc, TableMeta tableMeta) {
    classDescSupport.addImportName(entityDesc, ClassConstants.Entity);
    if (entityDesc.getCatalogName() != null
            || entityDesc.getSchemaName() != null
            || entityDesc.getTableName() != null) {
        classDescSupport.addImportName(entityDesc, ClassConstants.Table);
    }
    if (superclass != null) {
        classDescSupport.addImportName(entityDesc, superclass.getName());
    }
    if (namingType != NamingType.NONE) {
        classDescSupport.addImportName(entityDesc,
                namingType.getEnumConstant());
    }
    if (originalStatesPropertyName != null) {
        classDescSupport.addImportName(entityDesc,
                ClassConstants.OriginalStates);
    }
    for (EntityPropertyDesc propertyDesc : entityDesc
            .getOwnEntityPropertyDescs()) {
        if (propertyDesc.isId()) {
            classDescSupport.addImportName(entityDesc, ClassConstants.Id);
            if (propertyDesc.getGenerationType() != null) {
                classDescSupport.addImportName(entityDesc,
                        ClassConstants.GeneratedValue);
                classDescSupport.addImportName(entityDesc,
                        ClassConstants.GenerationType);
                GenerationType generationType = propertyDesc
                        .getGenerationType();
                if (generationType != null) {
                    classDescSupport.addImportName(entityDesc,
                            generationType.getEnumConstant());
                    if (generationType == GenerationType.SEQUENCE) {
                        classDescSupport.addImportName(entityDesc,
                                ClassConstants.SequenceGenerator);
                    } else if (generationType == GenerationType.TABLE) {
                        classDescSupport.addImportName(entityDesc,
                                ClassConstants.TableGenerator);
                    }
                }
            }
        }
        classDescSupport.addImportName(entityDesc, ClassConstants.Column);
        if (propertyDesc.isVersion()) {
            classDescSupport.addImportName(entityDesc,
                    ClassConstants.Version);
        }
        classDescSupport.addImportName(entityDesc,
                propertyDesc.getPropertyClassName());
    }
}
 
开发者ID:domaframework,项目名称:doma-gen,代码行数:60,代码来源:EntityDescFactory.java

示例4: doFieldElements

import org.seasar.doma.Id; //导入依赖的package包/类
@Override
public void doFieldElements(TypeElement embeddableElement,
        EmbeddableMeta embeddableMeta) {
    for (VariableElement fieldElement : getFieldElements(embeddableElement)) {
        try {
            if (fieldElement.getAnnotation(Transient.class) != null) {
                continue;
            } else if (fieldElement.getModifiers().contains(
                    Modifier.STATIC)) {
                continue;
            } else if (fieldElement.getAnnotation(OriginalStates.class) != null) {
                throw new AptException(Message.DOMA4286, env,
                        fieldElement, new Object[] {
                                embeddableElement.getQualifiedName(),
                                fieldElement.getSimpleName() });
            } else if (fieldElement.getAnnotation(Id.class) != null) {
                throw new AptException(Message.DOMA4289, env,
                        fieldElement, new Object[] {
                                embeddableElement.getQualifiedName(),
                                fieldElement.getSimpleName() });
            } else if (fieldElement.getAnnotation(Version.class) != null) {
                throw new AptException(Message.DOMA4290, env,
                        fieldElement, new Object[] {
                                embeddableElement.getQualifiedName(),
                                fieldElement.getSimpleName() });
            } else if (fieldElement.getAnnotation(TenantId.class) != null) {
                throw new AptException(Message.DOMA4443, env,
                        fieldElement, new Object[] {
                                embeddableElement.getQualifiedName(),
                                fieldElement.getSimpleName() });
            } else if (fieldElement.getAnnotation(GeneratedValue.class) != null) {
                throw new AptException(Message.DOMA4291, env,
                        fieldElement, new Object[] {
                                embeddableElement.getQualifiedName(),
                                fieldElement.getSimpleName() });
            } else {
                doEmbeddablePropertyMeta(fieldElement, embeddableMeta);
            }
        } catch (AptException e) {
            Notifier.notify(env, e);
            embeddableMeta.setError(true);
        }
    }
}
 
开发者ID:domaframework,项目名称:doma,代码行数:45,代码来源:EmbeddableMetaFactory.java


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