1 package org.opendaylight.controller.md.sal.dom.xsql;
3 import java.io.Serializable;
5 public class XSQLColumn implements Serializable, Comparable<Object> {
6 private static final long serialVersionUID = 4854919735031714751L;
8 private String name = null;
9 private String tableName = null;
10 private int charWidth = -1;
11 private Class<?> type = null;
12 private transient Object bluePrintNode = null;
13 private String origName = null;
14 private String origTableName = null;
16 public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) {
17 this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode);
18 this.tableName = _tableName;
19 this.bluePrintNode = _bluePrintNode;
20 this.type = XSQLODLUtils.getTypeForODLColumn(odlNode);
23 public XSQLColumn(String _name, String _tableName,String _origName, String _origTableName){
25 this.tableName = _tableName;
26 this.origName = _origName;
27 this.origTableName = _origTableName;
30 public String getName() {
34 public String getTableName() {
38 public void setCharWidth(int i) {
39 if (this.charWidth < i) {
44 public int getCharWidth() {
45 return this.charWidth;
49 public int hashCode() {
50 return this.name.hashCode() + this.tableName.hashCode();
54 public boolean equals(Object obj) {
55 if (!(obj instanceof XSQLColumn)) {
58 XSQLColumn other = (XSQLColumn) obj;
59 return tableName.equals(other.tableName) && name.equals(other.name);
62 public Object getBluePrintNode() {
63 return this.bluePrintNode;
67 public String toString() {
68 return tableName + "." + name;
72 public int compareTo(Object o) {
73 return this.toString().compareTo(o.toString());
76 public Object getResultSetValue(Object obj){
77 if(this.type.equals(String.class)){
78 return obj.toString();
80 if(this.type.equals(int.class)){
81 return Integer.parseInt(obj.toString());
83 if(this.type.equals(long.class)){
84 return Long.parseLong(obj.toString());
86 if(this.type.equals(byte.class)){
87 return Byte.parseByte(obj.toString());