Source Code Cross Referenced for MapMetaData.java in  » Database-ORM » TJDO » com » triactive » jdo » model » 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 ORM » TJDO » com.triactive.jdo.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002 (C) TJDO.
003:         * All rights reserved.
004:         *
005:         * This software is distributed under the terms of the TJDO License version 1.0.
006:         * See the terms of the TJDO License in the documentation provided with this software.
007:         *
008:         * $Id: MapMetaData.java,v 1.6 2004/01/25 20:44:32 jackknifebarber Exp $
009:         */
010:
011:        package com.triactive.jdo.model;
012:
013:        import java.util.List;
014:        import java.util.Set;
015:        import javax.jdo.JDOFatalInternalException;
016:        import org.w3c.dom.Element;
017:
018:        public class MapMetaData extends MetaData {
019:            protected final Class keyType;
020:            protected final Class valueType;
021:            protected final boolean embeddedKey;
022:            protected final boolean embeddedValue;
023:            protected final boolean allowsNullValues;
024:
025:            public MapMetaData(FieldMetaData fmd, Element elem) {
026:                super (fmd.getClassMetaData().getSourceURL(), elem);
027:
028:                String typeAttr = elem.getAttribute("key-type");
029:                String embeddedAttr = elem.getAttribute("embedded-key");
030:
031:                keyType = getReferencedType(typeAttr, fmd.getClassMetaData());
032:
033:                if (embeddedAttr.length() > 0)
034:                    embeddedKey = Boolean.valueOf(embeddedAttr).booleanValue();
035:                else
036:                    embeddedKey = Types.isDefaultEmbeddedType(keyType);
037:
038:                typeAttr = elem.getAttribute("value-type");
039:                embeddedAttr = elem.getAttribute("embedded-value");
040:
041:                valueType = getReferencedType(typeAttr, fmd.getClassMetaData());
042:
043:                if (embeddedAttr.length() > 0)
044:                    embeddedValue = Boolean.valueOf(embeddedAttr)
045:                            .booleanValue();
046:                else
047:                    embeddedValue = Types.isDefaultEmbeddedType(valueType);
048:
049:                if (fmd.getType() == java.util.Hashtable.class)
050:                    allowsNullValues = false;
051:                else
052:                    allowsNullValues = true;
053:            }
054:
055:            public String getJavaName() {
056:                throw new JDOFatalInternalException(
057:                        "MapMetaData has no equivalent Java identifier");
058:            }
059:
060:            public Class getKeyType() {
061:                return keyType;
062:            }
063:
064:            public Class getValueType() {
065:                return valueType;
066:            }
067:
068:            public boolean isEmbeddedKey() {
069:                return embeddedKey;
070:            }
071:
072:            public boolean isEmbeddedValue() {
073:                return embeddedValue;
074:            }
075:
076:            public boolean allowsNullValues() {
077:                return allowsNullValues;
078:            }
079:
080:            public ColumnOptions getKeyColumnOptions() {
081:                return new ColumnOptions() {
082:                    public String getLength() {
083:                        String length = getVendorExtension(MY_VENDOR,
084:                                "key-length");
085:
086:                        if (length == null)
087:                            length = getVendorExtension(MY_VENDOR, "length");
088:
089:                        return length;
090:                    }
091:
092:                    public String getPrecision() {
093:                        String precision = getVendorExtension(MY_VENDOR,
094:                                "key-precision");
095:
096:                        if (precision == null)
097:                            precision = getVendorExtension(MY_VENDOR,
098:                                    "precision");
099:
100:                        return precision;
101:                    }
102:
103:                    public String getScale() {
104:                        String scale = getVendorExtension(MY_VENDOR,
105:                                "key-scale");
106:
107:                        if (scale == null)
108:                            scale = getVendorExtension(MY_VENDOR, "scale");
109:
110:                        return scale;
111:                    }
112:                };
113:            }
114:
115:            public ColumnOptions getValueColumnOptions() {
116:                return new ColumnOptions() {
117:                    public String getLength() {
118:                        return getVendorExtension(MY_VENDOR, "value-length");
119:                    }
120:
121:                    public String getPrecision() {
122:                        return getVendorExtension(MY_VENDOR, "value-precision");
123:                    }
124:
125:                    public String getScale() {
126:                        return getVendorExtension(MY_VENDOR, "value-scale");
127:                    }
128:                };
129:            }
130:
131:            public boolean isInverseMap() {
132:                return getOwnerField() != null;
133:            }
134:
135:            public boolean clearOnDelete() {
136:                String codAttr = getVendorExtension(MY_VENDOR,
137:                        "clear-on-delete");
138:
139:                return codAttr == null ? true : Boolean.valueOf(codAttr)
140:                        .booleanValue();
141:            }
142:
143:            public FieldMetaData getOwnerField() {
144:                String ownerFieldName = getVendorExtension(MY_VENDOR,
145:                        "owner-field");
146:
147:                return ownerFieldName == null ? null : FieldMetaData.forField(
148:                        valueType, ownerFieldName);
149:            }
150:
151:            public FieldMetaData getKeyField() {
152:                String keyFieldName = getVendorExtension(MY_VENDOR, "key-field");
153:
154:                return keyFieldName == null ? null : FieldMetaData.forField(
155:                        valueType, keyFieldName);
156:            }
157:
158:            void getReferencedClasses(final String vendorID,
159:                    final List ordered, final Set referenced) {
160:                ClassMetaData cmd = ClassMetaData.forClass(keyType);
161:
162:                if (cmd != null)
163:                    cmd.getReferencedClasses(vendorID, ordered, referenced);
164:
165:                cmd = ClassMetaData.forClass(valueType);
166:
167:                if (cmd != null)
168:                    cmd.getReferencedClasses(vendorID, ordered, referenced);
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.