1 package org.opendaylight.controller.md.sal.dom.xsql;
3 import java.io.Serializable;
5 public class XSQLColumn implements Serializable, Comparable {
6 private String name = null;
7 private String tableName = null;
8 private int charWidth = -1;
9 private Class<?> type = null;
10 private transient Object bluePrintNode = null;
11 private String origName = null;
12 private String origTableName = null;
14 public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) {
15 this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode);
16 this.tableName = _tableName;
17 this.bluePrintNode = _bluePrintNode;
18 this.type = XSQLODLUtils.getTypeForODLColumn(odlNode);
21 public XSQLColumn(String _name, String _tableName,String _origName, String _origTableName){
23 this.tableName = _tableName;
24 this.origName = _origName;
25 this.origTableName = _origTableName;
28 public String getName() {
32 public String getTableName() {
36 public void setCharWidth(int i) {
37 if (this.charWidth < i) {
42 public int getCharWidth() {
43 return this.charWidth;
47 public int hashCode() {
48 return this.name.hashCode() + this.tableName.hashCode();
52 public boolean equals(Object obj) {
53 if (!(obj instanceof XSQLColumn)) {
56 XSQLColumn other = (XSQLColumn) obj;
57 return tableName.equals(other.tableName) && name.equals(other.name);
60 public Object getBluePrintNode() {
61 return this.bluePrintNode;
65 public String toString() {
66 return tableName + "." + name;
70 public int compareTo(Object o) {
71 return this.toString().compareTo(o.toString());
74 public Object getResultSetValue(Object obj){
75 if(this.type.equals(String.class)){
76 return obj.toString();
78 if(this.type.equals(int.class)){
79 return Integer.parseInt(obj.toString());
81 if(this.type.equals(long.class)){
82 return Long.parseLong(obj.toString());
84 if(this.type.equals(byte.class)){
85 return Byte.parseByte(obj.toString());