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;
12 public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) {
13 this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode);
14 this.tableName = _tableName;
15 this.bluePrintNode = _bluePrintNode;
16 this.type = XSQLODLUtils.getTypeForODLColumn(odlNode);
19 public String getName() {
23 public String getTableName() {
27 public void setCharWidth(int i) {
28 if (this.charWidth < i) {
33 public int getCharWidth() {
34 return this.charWidth;
38 public int hashCode() {
39 return this.name.hashCode() + this.tableName.hashCode();
43 public boolean equals(Object obj) {
44 if (!(obj instanceof XSQLColumn)) {
47 XSQLColumn other = (XSQLColumn) obj;
48 return tableName.equals(other.tableName) && name.equals(other.name);
51 public Object getBluePrintNode() {
52 return this.bluePrintNode;
56 public String toString() {
57 return tableName + "." + name;
61 public int compareTo(Object o) {
62 return this.toString().compareTo(o.toString());
65 public Object getResultSetValue(Object obj){
66 if(this.type.equals(String.class)){
67 return obj.toString();
69 if(this.type.equals(int.class)){
70 return Integer.parseInt(obj.toString());
72 if(this.type.equals(long.class)){
73 return Long.parseLong(obj.toString());
75 if(this.type.equals(byte.class)){
76 return Byte.parseByte(obj.toString());