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 SHORT(new ShortTypeHandler(), JdbcType.SMALLINT),
49 INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER),
50 LONG(new LongTypeHandler(), JdbcType.BIGINT),
51 FLOAT(new FloatTypeHandler(), JdbcType.FLOAT),
52 DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE),
53 BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL),
54
55 STRING(new StringTypeHandler(), JdbcType.VARCHAR),
56 CLOB(new ClobTypeHandler(), JdbcType.CLOB),
57 LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR),
58
59 BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY),
60 BLOB(new BlobTypeHandler(), JdbcType.BLOB),
61 LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY),
62
63 OBJECT(new ObjectTypeHandler(), JdbcType.OTHER),
64 OTHER(new ObjectTypeHandler(), JdbcType.OTHER),
65 TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP),
66 DATE(new DateOnlyTypeHandler(), JdbcType.DATE),
67 TIME(new TimeOnlyTypeHandler(), JdbcType.TIME),
68 SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP),
69 SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE),
70 SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME);
71
72 private TypeHandler<?> typeHandler;
73 private JdbcType jdbcType;
74
75 private Null(TypeHandler<?> typeHandler, JdbcType jdbcType) {
76 this.typeHandler = typeHandler;
77 this.jdbcType = jdbcType;
78 }
79
80 public TypeHandler<?> getTypeHandler() {
81 return typeHandler;
82 }
83
84 public JdbcType getJdbcType() {
85 return jdbcType;
86 }
87 }