本文整理汇总了Java中org.seasar.doma.Column类的典型用法代码示例。如果您正苦于以下问题:Java Column类的具体用法?Java Column怎么用?Java Column使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Column类属于org.seasar.doma包,在下文中一共展示了Column类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newInstance
import org.seasar.doma.Column; //导入依赖的package包/类
public static ColumnMirror newInstance(VariableElement field,
ProcessingEnvironment env) {
assertNotNull(env);
AnnotationMirror annotationMirror = ElementUtil.getAnnotationMirror(
field, Column.class, env);
if (annotationMirror == null) {
return null;
}
ColumnMirror result = new ColumnMirror(annotationMirror);
for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : env
.getElementUtils()
.getElementValuesWithDefaults(annotationMirror).entrySet()) {
String name = entry.getKey().getSimpleName().toString();
AnnotationValue value = entry.getValue();
if ("name".equals(name)) {
result.name = value;
} else if ("insertable".equals(name)) {
result.insertable = value;
} else if ("updatable".equals(name)) {
result.updatable = value;
} else if ("quote".equals(name)) {
result.quote = value;
}
}
return result;
}
示例2: doImportName
import org.seasar.doma.Column; //导入依赖的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());
}
}
示例3: getSuperclassEntityPropertyInfo
import org.seasar.doma.Column; //导入依赖的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;
}
示例4: handleImportName
import org.seasar.doma.Column; //导入依赖的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());
}
}