本文整理汇总了Java中org.nutz.dao.entity.annotation.ColDefine类的典型用法代码示例。如果您正苦于以下问题:Java ColDefine类的具体用法?Java ColDefine怎么用?Java ColDefine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColDefine类属于org.nutz.dao.entity.annotation包,在下文中一共展示了ColDefine类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMappingInfo
import org.nutz.dao.entity.annotation.ColDefine; //导入依赖的package包/类
/**
* 根据 Java 字段创建一个实体字段信息对象
*
* @param pk
* 复合主键
* @param field
* Java 字段
* @return 字段信息对象
*/
public static MappingInfo createMappingInfo(PK pk, Field field) {
MappingInfo info = create(MappingInfo.class, field);
info.annPK = pk;
info.annColumn = field.getAnnotation(Column.class);
info.annDefine = field.getAnnotation(ColDefine.class);
info.annDefault = field.getAnnotation(Default.class);
info.annId = field.getAnnotation(Id.class);
info.annName = field.getAnnotation(Name.class);
info.annNext = field.getAnnotation(Next.class);
info.annPrev = field.getAnnotation(Prev.class);
info.annReadonly = field.getAnnotation(Readonly.class);
info.columnComment = field.getAnnotation(Comment.class);
//检查@Id和@Name的属性类型
if (info.annId != null) {
if (!Mirror.me(field.getType()).isIntLike())
throw Lang.makeThrow(DaoException.class, "Field(%s) annotation @Id , but not Number type!!", field);
}
if (info.annName != null)
if (!Mirror.me(field.getType()).isStringLike())
throw Lang.makeThrow(DaoException.class, "Field(%s) annotation @Name , but not String type!!", field);
return info;
}
示例2: createMapingInfo
import org.nutz.dao.entity.annotation.ColDefine; //导入依赖的package包/类
/**
* 根据 getter/setter 函数获取一个实体字段信息对象
*
* @param pk
* 复合主键
* @param method
* 方法:可能是 getter 或者是 setter
* @return 字段信息对象
*/
public static MappingInfo createMapingInfo(PK pk, Method method) {
MappingInfo info = create(MappingInfo.class, method);
info.annPK = pk;
info.annColumn = method.getAnnotation(Column.class);
info.annDefine = method.getAnnotation(ColDefine.class);
info.annDefault = method.getAnnotation(Default.class);
info.annId = method.getAnnotation(Id.class);
info.annName = method.getAnnotation(Name.class);
info.annNext = method.getAnnotation(Next.class);
info.annPrev = method.getAnnotation(Prev.class);
info.annReadonly = method.getAnnotation(Readonly.class);
return info;
}