Source Code Cross Referenced for ObjectDefinition.java in  » IDE-Netbeans » etl.project » org » netbeans » modules » masterindex » plugin » datamodel » 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 » IDE Netbeans » etl.project » org.netbeans.modules.masterindex.plugin.datamodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.masterindex.plugin.datamodel;
042:
043:        import java.util.ArrayList;
044:
045:        /**
046:         * 
047:         * this represent the ObjectDefinition or metaData for a given DataObject
048:         * 
049:         * 
050:         * @author Sujit Biswas
051:         * 
052:         */
053:        public class ObjectDefinition {
054:
055:            private String name;
056:
057:            /**
058:             * list of fields
059:             */
060:            ArrayList<Field> fields = new ArrayList<Field>();
061:
062:            /**
063:             * list of children
064:             */
065:            ArrayList<ObjectDefinition> children = new ArrayList<ObjectDefinition>();
066:
067:            /**
068:             * @param name
069:             */
070:            public ObjectDefinition(String name) {
071:                super ();
072:                this .name = name;
073:            }
074:
075:            /**
076:             * @param name
077:             * @param fields
078:             * @param children
079:             */
080:            public ObjectDefinition(String name, ArrayList<Field> fields,
081:                    ArrayList<ObjectDefinition> children) {
082:                super ();
083:                this .name = name;
084:                this .fields = fields;
085:                this .children = children;
086:            }
087:
088:            /**
089:             * add field
090:             * 
091:             * @param o
092:             * @return
093:             */
094:            public boolean addField(Field o) {
095:                return fields.add(o);
096:            }
097:
098:            /**
099:             * add field at a specified location, shift the elements from the current
100:             * position to the right
101:             * 
102:             * @param index
103:             * @param element
104:             */
105:            public void addField(int index, Field element) {
106:                fields.add(index, element);
107:            }
108:
109:            private void ensureFieldCapacity(int minCapacity) {
110:                int size = minCapacity + 1;
111:
112:                if (fields.size() < size) {
113:                    for (int i = fields.size(); i < size; i++) {
114:                        fields.add(i, null);
115:                    }
116:                }
117:
118:            }
119:
120:            /**
121:             * get field for the given index
122:             * 
123:             * @param index
124:             * @return
125:             */
126:            public Field getField(int index) {
127:                return fields.get(index);
128:            }
129:
130:            /**
131:             * set the field at the given index
132:             * 
133:             * @param index
134:             * @param element
135:             * @return
136:             */
137:            public Field setField(int index, Field element) {
138:                ensureFieldCapacity(index);
139:                return fields.set(index, element);
140:            }
141:
142:            /**
143:             * add child at the given index
144:             * 
145:             * @param index
146:             * @param element
147:             */
148:            public void addchild(int index, ObjectDefinition element) {
149:                children.add(index, element);
150:            }
151:
152:            /**
153:             * add child
154:             * 
155:             * @param o
156:             * @return
157:             */
158:            public boolean addchild(ObjectDefinition o) {
159:                return children.add(o);
160:            }
161:
162:            /**
163:             * get child at the given index
164:             * 
165:             * @param index
166:             * @return
167:             */
168:            public ObjectDefinition getchild(int index) {
169:                return children.get(index);
170:            }
171:
172:            /**
173:             * set child at the given index
174:             * 
175:             * @param index
176:             * @param element
177:             * @return
178:             */
179:            public ObjectDefinition setchild(int index, ObjectDefinition element) {
180:                ensureChildCapacity(index);
181:                return children.set(index, element);
182:            }
183:
184:            private void ensureChildCapacity(int minCapacity) {
185:                int size = minCapacity + 1;
186:
187:                if (children.size() < size) {
188:                    for (int i = children.size(); i < size; i++) {
189:                        children.add(i, null);
190:                    }
191:                }
192:
193:            }
194:
195:            /**
196:             * @return the children
197:             */
198:            public ArrayList<ObjectDefinition> getChildren() {
199:                return children;
200:            }
201:
202:            /**
203:             * @param children
204:             *            the children to set
205:             */
206:            public void setChildren(ArrayList<ObjectDefinition> children) {
207:                this .children = children;
208:            }
209:
210:            /**
211:             * @return the fields
212:             */
213:            public ArrayList<Field> getFields() {
214:                return fields;
215:            }
216:
217:            /**
218:             * @param fields
219:             *            the fields to set
220:             */
221:            public void setFields(ArrayList<Field> fields) {
222:                this .fields = fields;
223:            }
224:
225:            /**
226:             * @return the name
227:             */
228:            public String getName() {
229:                return name;
230:            }
231:
232:            /**
233:             * @param name
234:             *            the name to set
235:             */
236:            public void setName(String name) {
237:                this .name = name;
238:            }
239:
240:            /*
241:             * (non-Javadoc)
242:             * 
243:             * @see java.lang.Object#toString()
244:             */
245:            @Override
246:            public String toString() {
247:                StringBuilder sb = new StringBuilder();
248:
249:                sb.append("name: " + name + "\n");
250:
251:                sb.append(" Fields: \n");
252:                sb.append(fields.toString());
253:
254:                if (!children.isEmpty())
255:                    sb.append("\nChildren: ");
256:
257:                for (ObjectDefinition c : children) {
258:
259:                    sb.append("\n child ");
260:                    if (c != null)
261:                        sb.append(c.toString());
262:                }
263:
264:                return sb.toString();
265:            }
266:
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.