1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.jdbc;
17
18 import org.apache.ibatis.type.BigDecimalTypeHandler;
19 import org.apache.ibatis.type.BlobTypeHandler;
20 import org.apache.ibatis.type.BooleanTypeHandler;
21 import org.apache.ibatis.type.ByteArrayTypeHandler;
22 import org.apache.ibatis.type.ByteTypeHandler;
23 import org.apache.ibatis.type.ClobTypeHandler;
24 import org.apache.ibatis.type.DateOnlyTypeHandler;
25 import org.apache.ibatis.type.DateTypeHandler;
26 import org.apache.ibatis.type.DoubleTypeHandler;
27 import org.apache.ibatis.type.FloatTypeHandler;
28 import org.apache.ibatis.type.IntegerTypeHandler;
29 import org.apache.ibatis.type.JdbcType;
30 import org.apache.ibatis.type.LongTypeHandler;
31 import org.apache.ibatis.type.ObjectTypeHandler;
32 import org.apache.ibatis.type.ShortTypeHandler;
33 import org.apache.ibatis.type.SqlDateTypeHandler;
34 import org.apache.ibatis.type.SqlTimeTypeHandler;
35 import org.apache.ibatis.type.SqlTimestampTypeHandler;
36 import org.apache.ibatis.type.StringTypeHandler;
37 import org.apache.ibatis.type.TimeOnlyTypeHandler;
38 import org.apache.ibatis.type.TypeHandler;
39
40
41
42
43
44 public enum Null {
45 BOOLEAN(new BooleanTypeHandler(), JdbcType.BOOLEAN),
46
47 BYTE(new ByteTypeHandler(), JdbcType.TINYINT),
48
49 SHORT(new ShortTypeHandler(), JdbcType.SMALLINT),
50
51 INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER),
52
53 LONG(new LongTypeHandler(), JdbcType.BIGINT),
54
55 FLOAT(new FloatTypeHandler(), JdbcType.FLOAT),
56
57 DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE),
58
59 BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL),
60
61 STRING(new StringTypeHandler(), JdbcType.VARCHAR),
62
63 CLOB(new ClobTypeHandler(), JdbcType.CLOB),
64
65 LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR),
66
67 BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY),
68
69 BLOB(new BlobTypeHandler(), JdbcType.BLOB),
70
71 LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY),
72
73 OBJECT(new ObjectTypeHandler(), JdbcType.OTHER),
74
75 OTHER(new ObjectTypeHandler(), JdbcType.OTHER),
76
77 TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP),
78
79 DATE(new DateOnlyTypeHandler(), JdbcType.DATE),
80
81 TIME(new TimeOnlyTypeHandler(), JdbcType.TIME),
82
83 SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP),
84
85 SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE),
86
87 SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME);
88
89 private final TypeHandler<?> typeHandler;
90 private final JdbcType jdbcType;
91
92 Null(TypeHandler<?> typeHandler, JdbcType jdbcType) {
93 this.typeHandler = typeHandler;
94 this.jdbcType = jdbcType;
95 }
96
97 public TypeHandler<?> getTypeHandler() {
98 return typeHandler;
99 }
100
101 public JdbcType getJdbcType() {
102 return jdbcType;
103 }
104 }