forked from OpenIntegrationEngine/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColumn.java
More file actions
108 lines (92 loc) · 2.84 KB
/
Column.java
File metadata and controls
108 lines (92 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
* http://www.mirthcorp.com
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/
package com.mirth.connect.connectors.jdbc;
import java.io.Serializable;
import java.sql.Types;
/**
* Object to hold column information for a particular table.
*
*/
public class Column implements Serializable {
private String name; // column name
private String type; // SQL Type name, should follow @{link java.sql.Types}
private int precision; // precision for the SQL type
/**
* @param name
* Column's name
* @param type
* A SQL type name
* @param precision
* Precision for the type (eg. the length for numeric, or characters for string)
*/
public Column(String name, String type, int precision) {
super();
this.name = name;
this.type = type;
this.precision = precision;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* @return The name of the SQL column type {@link Types}
*/
public String getType() {
return type;
}
/**
* @param type
* The SQL type name {@link Types}
*/
public void setType(String type) {
this.type = type;
}
public int getPrecision() {
return precision;
}
public void setPrecision(int precision) {
this.precision = precision;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof Column))
return false;
Column col = (Column) obj;
if (name != null && !name.equals(col.getName()))
return false;
if (type != null && !type.equals(col.getType()))
return false;
if (precision != col.getPrecision())
return false;
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + (name == null ? 0 : name.hashCode());
hashCode = 31 * hashCode + (type == null ? 0 : type.hashCode());
hashCode = 31 * hashCode + precision;
return hashCode;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append(this.getClass().getName() + "[");
builder.append("name=" + getName() + ", ");
builder.append("type=" + getType() + ", ");
builder.append("precision=" + getPrecision() + ", ");
builder.append("]");
return builder.toString();
}
}