Class MybatisEnumTypeHandler<E extends Enum<E>>
java.lang.Object
org.apache.ibatis.type.TypeReference<T>
org.apache.ibatis.type.BaseTypeHandler<E>
top.tangyh.basic.database.mybatis.handlers.MybatisEnumTypeHandler<E>
- Type Parameters:
E- 枚举类型
- All Implemented Interfaces:
org.apache.ibatis.type.TypeHandler<E>
public class MybatisEnumTypeHandler<E extends Enum<E>>
extends org.apache.ibatis.type.BaseTypeHandler<E>
自定义枚举属性转换器
- Since:
- 2017-10-11
- Author:
- hubin
-
Field Summary
Fields inherited from class org.apache.ibatis.type.BaseTypeHandler
configuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanequalsValue(Object sourceValue, Object targetValue) 值比较findEnumValueFieldName(Class<?> clazz) 查找标记标记EnumValue字段getNullableResult(CallableStatement cs, int columnIndex) getNullableResult(ResultSet rs, int columnIndex) getNullableResult(ResultSet rs, String columnName) static boolean判断是否为MP枚举处理voidsetNonNullParameter(PreparedStatement ps, int i, E parameter, org.apache.ibatis.type.JdbcType jdbcType) Methods inherited from class org.apache.ibatis.type.BaseTypeHandler
getResult, getResult, getResult, setConfiguration, setParameterMethods inherited from class org.apache.ibatis.type.TypeReference
getRawType, toString
-
Constructor Details
-
MybatisEnumTypeHandler
-
-
Method Details
-
findEnumValueFieldName
查找标记标记EnumValue字段- Parameters:
clazz- class- Returns:
- EnumValue字段
- Since:
- 3.3.1
-
isMpEnums
判断是否为MP枚举处理- Parameters:
clazz- class- Returns:
- 是否为MP枚举处理
- Since:
- 3.3.1
-
setNonNullParameter
public void setNonNullParameter(PreparedStatement ps, int i, E parameter, org.apache.ibatis.type.JdbcType jdbcType) throws SQLException - Specified by:
setNonNullParameterin classorg.apache.ibatis.type.BaseTypeHandler<E extends Enum<E>>- Throws:
SQLException
-
getNullableResult
- Specified by:
getNullableResultin classorg.apache.ibatis.type.BaseTypeHandler<E extends Enum<E>>- Throws:
SQLException
-
getNullableResult
- Specified by:
getNullableResultin classorg.apache.ibatis.type.BaseTypeHandler<E extends Enum<E>>- Throws:
SQLException
-
getNullableResult
- Specified by:
getNullableResultin classorg.apache.ibatis.type.BaseTypeHandler<E extends Enum<E>>- Throws:
SQLException
-
equalsValue
值比较- Parameters:
sourceValue- 数据库字段值targetValue- 当前枚举属性值- Returns:
- 是否匹配
- Since:
- 3.3.0
-