类型处理器
确定一个类型处理器的顺序如下:
- 1st
Java
+Jdbc
- 2st
Java
- 3st
Jdbc
- 4st 使用
UnknownTypeHandler
类型处理器名称规则
dbVisitor 有着丰富的类型处理器,为了方便理解这些类型处理器它们有着统一的命名规则。这些规则分为三种:
<Java类型名>TypeHandler
<JDBC类型名>As<Java类型名>TypeHandler
<xxx>TypeHandler
类型处理器匹配表(第一优先级)
提示
下面表格中 Java类型 和 JDBC 必须全部满足才能选择对应的 类型处理器
,也是第一优先级。
JDBC 类型 | Java 类型 | 类型处理器 |
---|---|---|
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR , Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.time.MonthDay | StringAsMonthDayTypeHandler |
Types.TINYINT , Types.SMALLINT , Types.INTEGER , Types.BIGINT , Types.FLOAT , Types.DOUBLE , Types.REAL , Types.NUMERIC , Types.DECIMAL | java.time.MonthDay | IntegerAsMonthDayTypeHandler |
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR , Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.time.YearMonth | StringAsYearMonthTypeHandler |
Types.TINYINT , Types.SMALLINT , Types.INTEGER , Types.BIGINT , Types.FLOAT , Types.DOUBLE , Types.REAL , Types.NUMERIC , Types.DECIMAL | java.time.YearMonth | IntegerAsYearMonthTypeHandler |
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR , Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.time.Year | StringAsYearTypeHandler |
Types.TINYINT , Types.SMALLINT , Types.INTEGER , Types.BIGINT , Types.FLOAT , Types.DOUBLE , Types.REAL , Types.NUMERIC , Types.DECIMAL | java.time.Year | IntegerAsYearTypeHandler |
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR , Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.time.Month | StringAsMonthTypeHandler |
Types.TINYINT , Types.SMALLINT , Types.INTEGER , Types.BIGINT , Types.FLOAT , Types.DOUBLE , Types.REAL , Types.NUMERIC , Types.DECIMAL | java.time.Month | IntegerAsMonthTypeHandler |
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR , Types.DATALINK , Types.ROWID | java.lang.String | StringTypeHandler |
Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.lang.String | NStringTypeHandler |
Types.CLOB | java.lang.String | ClobAsStringTypeHandler |
Types.NCLOB | java.lang.String | NClobAsStringTypeHandler |
Types.SQLXML | java.lang.String | SqlXmlTypeHandler |
Types.CHAR , Types.VARCHAR , Types.LONGVARCHAR | java.io.Reader | StringAsReaderTypeHandler |
Types.NCHAR , Types.NVARCHAR , Types.LONGNVARCHAR | java.io.Reader | NStringAsReaderTypeHandler |
Types.CLOB | java.io.Reader | ClobAsReaderTypeHandler |
Types.NCLOB | java.io.Reader | NClobAsReaderTypeHandler |
Types.SQLXML | java.io.Reader | SqlXmlForReaderTypeHandler |
Types.BINARY , Types.VARBINARY , Types.LONGVARBINARY , Types.ROWID | byte[] | BytesTypeHandler |
Types.BLOB | byte[] | BlobAsBytesTypeHandler |
Types.BINARY , Types.VARBINARY , Types.LONGVARBINARY , Types.ROWID | java.lang.Byte[] | BytesAsBytesWrapTypeHandler |
Types.BLOB | java.lang.Byte[] | BlobAsBytesWrapTypeHandler |
Types.BINARY , Types.VARBINARY , Types.LONGVARBINARY | java.io.InputStream | BytesAsInputStreamTypeHandler |
Types.BLOB | java.io.InputStream | BlobAsInputStreamTypeHandler |
Types.SQLXML | java.io.InputStream | SqlXmlForInputStreamTypeHandler |
Types.ARRAY | java.lang.Object | ArrayTypeHandler |
Types.DATALINK | java.net.URI | URITypeHandler |
Types.DATALINK | java.net.URL | URLTypeHandler |