001: package net.sourceforge.squirrel_sql.fw.sql;
002:
003: /*
004: * Copyright (C) 2002-2003 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: // TODO: Put in all the property accessors
022: public class DataTypeInfo extends DatabaseObjectInfo {
023: static final long serialVersionUID = -3501323961506084527L;
024:
025: private final int _dataType;
026: private final int _precision;
027: private final String _literalPrefix;
028: private final String _literalSuffix;
029: private final String _createParams;
030: private final int _nullable;
031: private final boolean _caseSensitive;
032: private final int _searchable;
033: private final boolean _unsigned;
034: private final boolean _money;
035: private final boolean _autoIncrement;
036: private final String _localTypeName;
037: private final int _minScale;
038: private final int _maxScale;
039: private final int _numPrecRadix;
040:
041: DataTypeInfo(String typeName, int dataType, int precision,
042: String literalPrefix, String literalSuffix,
043: String createParams, int nullable, boolean caseSensitive,
044: int searchable, boolean unsigned, boolean money,
045: boolean autoIncrement, String localTypeName, int minScale,
046: int maxScale, int numPrecRadix, SQLDatabaseMetaData md) {
047: super (null, null, typeName, DatabaseObjectType.DATATYPE, md);
048: _dataType = dataType;
049: _precision = precision;
050: _literalPrefix = literalPrefix;
051: _literalSuffix = literalSuffix;
052: _createParams = createParams;
053: _nullable = nullable;
054: _caseSensitive = caseSensitive;
055: _searchable = searchable;
056: _unsigned = unsigned;
057: _money = money;
058: _autoIncrement = autoIncrement;
059: _localTypeName = localTypeName;
060: _minScale = minScale;
061: _maxScale = maxScale;
062: _numPrecRadix = numPrecRadix;
063: }
064:
065: public int getDataType() {
066: return _dataType;
067: }
068:
069: public int getPrecision() {
070: return _precision;
071: }
072:
073: public String getLiteralPrefix() {
074: return _literalPrefix;
075: }
076:
077: public String getLiteralSuffix() {
078: return _literalSuffix;
079: }
080:
081: public String getCreateParams() {
082: return _createParams;
083: }
084:
085: /**
086: * @see java.lang.Object#hashCode()
087: */
088: @Override
089: public int hashCode() {
090: final int prime = 31;
091: int result = super .hashCode();
092: result = prime * result + (_autoIncrement ? 1231 : 1237);
093: return result;
094: }
095:
096: /**
097: * @see java.lang.Object#equals(java.lang.Object)
098: */
099: @Override
100: public boolean equals(Object obj) {
101: if (this == obj)
102: return true;
103: if (!super .equals(obj))
104: return false;
105: if (getClass() != obj.getClass())
106: return false;
107: final DataTypeInfo other = (DataTypeInfo) obj;
108: if (!getSimpleName().equals(other.getSimpleName()))
109: return false;
110: return true;
111: }
112:
113: /**
114: * @return the nullable
115: */
116: public int getNullable() {
117: return _nullable;
118: }
119:
120: /**
121: * @return the caseSensitive
122: */
123: public boolean isCaseSensitive() {
124: return _caseSensitive;
125: }
126:
127: /**
128: * @return the searchable
129: */
130: public int getSearchable() {
131: return _searchable;
132: }
133:
134: /**
135: * @return the unsigned
136: */
137: public boolean isUnsigned() {
138: return _unsigned;
139: }
140:
141: /**
142: * @return the money
143: */
144: public boolean isMoney() {
145: return _money;
146: }
147:
148: /**
149: * @return the autoIncrement
150: */
151: public boolean isAutoIncrement() {
152: return _autoIncrement;
153: }
154:
155: /**
156: * @return the localTypeName
157: */
158: public String getLocalTypeName() {
159: return _localTypeName;
160: }
161:
162: /**
163: * @return the minScale
164: */
165: public int getMinScale() {
166: return _minScale;
167: }
168:
169: /**
170: * @return the maxScale
171: */
172: public int getMaxScale() {
173: return _maxScale;
174: }
175:
176: /**
177: * @return the numPrecRadix
178: */
179: public int getNumPrecRadix() {
180: return _numPrecRadix;
181: }
182: }
|