org.nutz.dao.entity
接口 MappingField

所有超级接口:
EntityField
所有已知实现类:
NutMappingField

public interface MappingField
extends EntityField

这个接口描述了一个数据库字段与Java字段的映射关系

作者:
zozoh(zozohtnt@gmail.com)

方法摘要
 ValueAdaptor getAdaptor()
           
 java.lang.String getColumnComment()
           
 java.lang.String getColumnName()
           
 ColType getColumnType()
           
 java.lang.String getCustomDbType()
           
 java.lang.String getDefaultValue(java.lang.Object obj)
          根据实体的实例对象,获取默认值
 int getPrecision()
           
 int getWidth()
           
 boolean hasColumnComment()
           
 boolean hasDefaultValue()
           
 void injectValue(java.lang.Object obj, java.sql.ResultSet rs)
          通过 resultSet 为映射字段注入值
 boolean isAutoIncreasement()
          这个判断仅仅对于创建语句有作用。
 boolean isCasesensitive()
           
 boolean isCompositePk()
           
 boolean isId()
           
 boolean isName()
           
 boolean isNotNull()
           
 boolean isPk()
           
 boolean isReadonly()
           
 boolean isUnsigned()
           
 void setAdaptor(ValueAdaptor adaptor)
          设置字段值适配器
 void setAsNotNull()
          将字段设置成非空约束
 void setAsReadonly()
          将字段设置成只读
 void setColumnType(ColType colType)
          设置字段在数据库中的类型
 void setCustomDbType(java.lang.String customDbType)
           
 
从接口 org.nutz.dao.entity.EntityField 继承的方法
getEntity, getName, getType, getTypeClass, getTypeMirror, getValue, setValue
 

方法详细信息

injectValue

void injectValue(java.lang.Object obj,
                 java.sql.ResultSet rs)
通过 resultSet 为映射字段注入值

参数:
obj - 被注入对象
rs - 结果集

getAdaptor

ValueAdaptor getAdaptor()
返回:
字段值适配器

setAdaptor

void setAdaptor(ValueAdaptor adaptor)
设置字段值适配器

参数:
adaptor - 字段值适配器

getColumnName

java.lang.String getColumnName()
返回:
数据库中的字段名

getColumnComment

java.lang.String getColumnComment()
返回:
数据库中字段的注释

getColumnType

ColType getColumnType()
返回:
数据库中的字段类型

setColumnType

void setColumnType(ColType colType)
设置字段在数据库中的类型

参数:
colType - 数据库字段的类型

getDefaultValue

java.lang.String getDefaultValue(java.lang.Object obj)
根据实体的实例对象,获取默认值

参数:
obj - 当前实体的实例对象
返回:
数据库字段的默认值
另请参见:
Default

getWidth

int getWidth()
返回:
字段宽度。默认 0 表示自动决定

getPrecision

int getPrecision()
返回:
字段的精度,仅浮点有效。默认 2

isPk

boolean isPk()
返回:
当前字段是否是主键(包括复合主键)

isCompositePk

boolean isCompositePk()
返回:
当前字段是否是复合主键

isId

boolean isId()
返回:
当前字段是否是数字型主键

isName

boolean isName()
返回:
当前字段是否是字符型主键

isReadonly

boolean isReadonly()
返回:
当前字段是否是只读

setAsReadonly

void setAsReadonly()
将字段设置成只读


hasDefaultValue

boolean hasDefaultValue()
返回:
字段是否设置了默认值

isNotNull

boolean isNotNull()
返回:
当前字段有非空约束

isUnsigned

boolean isUnsigned()
返回:
是否为无符号

isCasesensitive

boolean isCasesensitive()
返回:
当前字段是否大小写敏感

setAsNotNull

void setAsNotNull()
将字段设置成非空约束


isAutoIncreasement

boolean isAutoIncreasement()
这个判断仅仅对于创建语句有作用。

返回:
当前字段是否是自增的

hasColumnComment

boolean hasColumnComment()
返回:
当前字段是否有注释。

setCustomDbType

void setCustomDbType(java.lang.String customDbType)

getCustomDbType

java.lang.String getCustomDbType()