Source Code Cross Referenced for Column.java in  » Database-DBMS » axion » org » axiondb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » axion » org.axiondb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Column.java,v 1.34 2005/12/20 18:32:40 ahimanikya Exp $
003:         * =======================================================================
004:         * Copyright (c) 2002-2005 Axion Development Team.  All rights reserved.
005:         *  
006:         * Redistribution and use in source and binary forms, with or without 
007:         * modification, are permitted provided that the following conditions 
008:         * are met:
009:         * 
010:         * 1. Redistributions of source code must retain the above 
011:         *    copyright notice, this list of conditions and the following 
012:         *    disclaimer. 
013:         *   
014:         * 2. Redistributions in binary form must reproduce the above copyright 
015:         *    notice, this list of conditions and the following disclaimer in 
016:         *    the documentation and/or other materials provided with the 
017:         *    distribution. 
018:         *   
019:         * 3. The names "Tigris", "Axion", nor the names of its contributors may 
020:         *    not be used to endorse or promote products derived from this 
021:         *    software without specific prior written permission. 
022:         *  
023:         * 4. Products derived from this software may not be called "Axion", nor 
024:         *    may "Tigris" or "Axion" appear in their names without specific prior
025:         *    written permission.
026:         *   
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
028:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
030:         * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
031:         * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
032:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
033:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
034:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
035:         * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
036:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
037:         * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
038:         * =======================================================================
039:         */
040:
041:        package org.axiondb;
042:
043:        import java.io.Serializable;
044:        import java.util.HashMap;
045:        import java.util.Map;
046:
047:        /**
048:         * Describes a column within a {@link Table}.
049:         * 
050:         * @version $Revision: 1.34 $ $Date: 2005/12/20 18:32:40 $
051:         * @author Chuck Burdick
052:         * @author Rodney Waldhoff
053:         * @author Ahimanikya Satapathy
054:         */
055:        public class Column implements  Serializable {
056:
057:            /**
058:             * Key for setting and retrieving the sqlType in this column's configuration
059:             */
060:            public static final String COLUMN_SQL_TYPE_CONFIG_KEY = "sqlType";
061:
062:            /**
063:             * Key for setting and retrieving the {@link DataType}in this column's configuration
064:             */
065:            public static final String DATA_TYPE_CONFIG_KEY = "type";
066:
067:            /**
068:             * Key for setting and retrieving the {@link Selectable default value}in this
069:             * column's configuration
070:             */
071:            public static final String DEFAULT_VALUE_CONFIG_KEY = "defaultValue";
072:
073:            /**
074:             * Key for setting and retrieving the name in this column's configuration
075:             */
076:            public static final String NAME_CONFIG_KEY = "name";
077:
078:            /**
079:             * Key for setting and retrieving the Identity column generation type
080:             */
081:            public static final String IDENTITY_GENERATION_TYPE = "identityType";
082:
083:            public static final String GENERATED_ALWAYS = "always";
084:            public static final String GENERATED_BY_DEFAULT = "default";
085:
086:            /**
087:             * Key for setting and retrieving generated column expression
088:             */
089:            public static final String GENERATED_COLUMN_TYPE = "generatedCol";
090:
091:            /**
092:             * Create column with the given <i>name </i> and <i>type </i>.
093:             * 
094:             * @param name the name of this column, which MUST NOT be <code>null</code>
095:             * @param type the {@link DataType}of this column, which MUST NOT be
096:             *        <code>null</code>
097:             * @throws NullPointerException if either parameter is <code>null</code>
098:             */
099:            public Column(String name, DataType type)
100:                    throws NullPointerException {
101:                this (name, type, null);
102:            }
103:
104:            /**
105:             * Create column with the given <i>name </i> and <i>type </i>.
106:             * 
107:             * @param name the name of this column, which MUST NOT be <code>null</code>
108:             * @param type the {@link DataType}of this column, which MUST NOT be
109:             *        <code>null</code>
110:             * @param config name-value pairs that configure this column
111:             * @param defaultValue the {@link Selectable default value}for this column, which may
112:             *        be <code>null</code>
113:             * @throws NullPointerException if either name or type is <code>null</code>
114:             */
115:            public Column(String name, DataType type, Selectable defaultValue)
116:                    throws NullPointerException {
117:                if (null == name) {
118:                    throw new NullPointerException(
119:                            "name parameter must not be null");
120:                }
121:                if (null == type) {
122:                    throw new NullPointerException(
123:                            "type parameter must not be null");
124:                }
125:                _config = new HashMap();
126:                getConfiguration().put(NAME_CONFIG_KEY, name);
127:                getConfiguration().put(DATA_TYPE_CONFIG_KEY, type);
128:                getConfiguration().put(DEFAULT_VALUE_CONFIG_KEY, defaultValue);
129:            }
130:
131:            /** Two {@link Column}s are equal if they have the same name. */
132:            public boolean equals(Object that) {
133:                if (that instanceof  Column) {
134:                    Column col = (Column) that;
135:                    return getName().equals(col.getName());
136:                }
137:                return false;
138:            }
139:
140:            public final Map getConfiguration() {
141:                return _config;
142:            }
143:
144:            /**
145:             * Get the {@link DataType}of this column.
146:             */
147:            public final DataType getDataType() {
148:                return (DataType) getConfiguration().get(DATA_TYPE_CONFIG_KEY);
149:            }
150:
151:            public final Selectable getDefault() {
152:                return (Selectable) getConfiguration().get(
153:                        DEFAULT_VALUE_CONFIG_KEY);
154:            }
155:
156:            /**
157:             * Get the name of this column.
158:             */
159:            public final String getName() {
160:                return (String) getConfiguration().get(NAME_CONFIG_KEY);
161:            }
162:
163:            public int getScale() {
164:                return getDataType().getScale();
165:            }
166:
167:            public int getSize() {
168:                return getDataType().getPrecision();
169:            }
170:
171:            public String getSqlType() {
172:                return (String) getConfiguration().get(
173:                        COLUMN_SQL_TYPE_CONFIG_KEY);
174:            }
175:
176:            public boolean hasDefault() {
177:                return null != getDefault();
178:            }
179:
180:            public boolean isIdentityColumn() {
181:                return null != getIdentityType();
182:            }
183:
184:            public boolean isGeneratedAlways() {
185:                return GENERATED_ALWAYS.equals(getIdentityType());
186:            }
187:
188:            public boolean isGeneratedByDefault() {
189:                return GENERATED_BY_DEFAULT.equals(getIdentityType());
190:            }
191:
192:            public boolean isDerivedColumn() {
193:                return GENERATED_ALWAYS.equals(getConfiguration().get(
194:                        GENERATED_COLUMN_TYPE));
195:            }
196:
197:            public void setGeneratedColType(String type) {
198:                getConfiguration().put(GENERATED_COLUMN_TYPE, type);
199:            }
200:
201:            public String getGeneratedColType() {
202:                return (String) getConfiguration().get(GENERATED_COLUMN_TYPE);
203:            }
204:
205:            public final String getIdentityType() {
206:                return (String) getConfiguration()
207:                        .get(IDENTITY_GENERATION_TYPE);
208:            }
209:
210:            public void setIdentityType(String type) {
211:                getConfiguration().put(IDENTITY_GENERATION_TYPE, type);
212:            }
213:
214:            public int hashCode() {
215:                return getName().hashCode();
216:            }
217:
218:            public void setSqlType(String type) {
219:                getConfiguration().put(COLUMN_SQL_TYPE_CONFIG_KEY, type);
220:            }
221:
222:            public String toString() {
223:                return getName();
224:            }
225:
226:            private Map _config;
227:            private static final long serialVersionUID = -9163914166152422736L;
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.