1 package org.apache.torque.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.commons.lang.builder.EqualsBuilder;
23 import org.apache.commons.lang.builder.HashCodeBuilder;
24
25
26
27
28
29
30 public class JdbcTypedValue
31 {
32
33 private int jdbcType;
34
35
36 private Object value;
37
38
39
40
41
42
43
44 public JdbcTypedValue(Object value, int jdbcType)
45 {
46 this.jdbcType = jdbcType;
47 this.value = value;
48 }
49
50
51
52
53
54
55 public int getJdbcType()
56 {
57 return jdbcType;
58 }
59
60
61
62
63
64
65 public void setJdbcType(int jdbcType)
66 {
67 this.jdbcType = jdbcType;
68 }
69
70
71
72
73
74
75 public Object getValue()
76 {
77 return value;
78 }
79
80
81
82
83
84
85 public void setValue(Object value)
86 {
87 this.value = value;
88 }
89
90 @Override
91 public int hashCode()
92 {
93 HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
94 .append(jdbcType)
95 .append(value);
96 return hashCodeBuilder.toHashCode();
97 }
98
99 @Override
100 public boolean equals(Object obj)
101 {
102 if (this == obj)
103 {
104 return true;
105 }
106 if (obj == null)
107 {
108 return false;
109 }
110 if (getClass() != obj.getClass())
111 {
112 return false;
113 }
114 JdbcTypedValue other = (JdbcTypedValue) obj;
115 EqualsBuilder equalsBuilder = new EqualsBuilder()
116 .append(jdbcType, other.jdbcType)
117 .append(value, other.value);
118 return equalsBuilder.isEquals();
119 }
120
121 @Override
122 public String toString()
123 {
124 return "JdbcTypedValue [jdbcType=" + jdbcType
125 + ", value=" + value + "]";
126 }
127 }