001: /*
002: * sqlc 1
003: * SQL Compiler
004: * Copyright (C) 2003 Hammurapi Group
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * URL: http://www.hammurapi.biz/products/sqlc/index.html
021: * e-Mail: support@hammurapi.biz
022: */
023: package biz.hammurapi.sql.metadata;
024:
025: /**
026: * @author Pavel Vlasov
027: * @version $Revision: 1.4 $
028: */
029: public class ColumnDescriptor extends ParameterDescriptor {
030: /**
031: * Comment for <code>serialVersionUID</code>
032: */
033: private static final long serialVersionUID = 600969979669392180L;
034: private String dbName;
035: private boolean isPrimaryKey;
036: private boolean isForeignKey;
037: private int position;
038: private String dbTypeName;
039: private Number size;
040: private Number decimalDigits;
041:
042: /**
043: *
044: */
045: public ColumnDescriptor() {
046:
047: // TODO Auto-generated constructor stub
048: }
049:
050: /**
051: * @return Returns the dbTypeName.
052: */
053: public String getDbTypeName() {
054: return dbTypeName;
055: }
056:
057: /**
058: * @return Column definition..
059: */
060: public String getDbDefinition() {
061: StringBuffer ret = new StringBuffer(getDbTypeName());
062: if (getSize() != null) {
063: ret.append("(");
064: ret.append(getSize());
065: if (getDecimalDigits() != null) {
066: ret.append(".");
067: ret.append(getDecimalDigits());
068: }
069: ret.append(")");
070: }
071: return ret.toString();
072: }
073:
074: /**
075: * @param dbTypeName The dbTypeName to set.
076: */
077: void setDbTypeName(String dbTypeName) {
078: this .dbTypeName = dbTypeName;
079: }
080:
081: /**
082: * @return Returns the decimalDigits.
083: */
084: public Number getDecimalDigits() {
085: return decimalDigits;
086: }
087:
088: /**
089: * @param decimalDigits The decimalDigits to set.
090: */
091: void setDecimalDigits(Number decimalDigits) {
092: this .decimalDigits = decimalDigits;
093: }
094:
095: /**
096: * @return Returns the size.
097: */
098: public Number getSize() {
099: return size;
100: }
101:
102: /**
103: * @param size The size to set.
104: */
105: void setSize(Number size) {
106: this .size = size;
107: }
108:
109: /**
110: * @param name The name to set.
111: */
112: public void setDbName(String name) {
113: this .dbName = name;
114: }
115:
116: /**
117: * @return Returns the name.
118: */
119: public String getDbName() {
120: return dbName;
121: }
122:
123: /**
124: * @param isPrimaryKey The isPrimaryKey to set.
125: */
126: public void setPrimaryKey(boolean isPrimaryKey) {
127: this .isPrimaryKey = isPrimaryKey;
128: }
129:
130: /**
131: * @return Returns the isPrimaryKey.
132: */
133: public boolean isPrimaryKey() {
134: return isPrimaryKey;
135: }
136:
137: /**
138: * @param isForeignKey The isForeignKey to set.
139: */
140: public void setForeignKey(boolean isForeignKey) {
141: this .isForeignKey = isForeignKey;
142: }
143:
144: /**
145: * @return Returns the isForeignKey.
146: */
147: public boolean isForeignKey() {
148: return isForeignKey;
149: }
150:
151: /**
152: * @param position The position to set.
153: */
154: public void setPosition(int position) {
155: this .position = position;
156: }
157:
158: /**
159: * @return Returns the position.
160: */
161: public int getPosition() {
162: return position;
163: }
164: }
|