Source Code Cross Referenced for ComponentMetamodel.java in  » Database-ORM » hibernate » org » hibernate » tuple » component » 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 » hibernate » org.hibernate.tuple.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.hibernate.tuple.component;
02:
03:        import org.hibernate.engine.SessionFactoryImplementor;
04:        import org.hibernate.mapping.Component;
05:        import org.hibernate.mapping.Property;
06:        import org.hibernate.HibernateException;
07:        import org.hibernate.tuple.StandardProperty;
08:        import org.hibernate.tuple.PropertyFactory;
09:
10:        import java.io.Serializable;
11:        import java.util.Iterator;
12:        import java.util.Map;
13:        import java.util.HashMap;
14:
15:        /**
16:         * Centralizes metamodel information about a component.
17:         *
18:         * @author Steve Ebersole
19:         */
20:        public class ComponentMetamodel implements  Serializable {
21:
22:            // TODO : will need reference to session factory to fully complete HHH-1907
23:
24:            //	private final SessionFactoryImplementor sessionFactory;
25:            private final String role;
26:            private final boolean isKey;
27:            private final StandardProperty[] properties;
28:            private final ComponentEntityModeToTuplizerMapping tuplizerMapping;
29:
30:            // cached for efficiency...
31:            private final int propertySpan;
32:            private final Map propertyIndexes = new HashMap();
33:
34:            //	public ComponentMetamodel(Component component, SessionFactoryImplementor sessionFactory) {
35:            public ComponentMetamodel(Component component) {
36:                //		this.sessionFactory = sessionFactory;
37:                this .role = component.getRoleName();
38:                this .isKey = component.isKey();
39:                propertySpan = component.getPropertySpan();
40:                properties = new StandardProperty[propertySpan];
41:                Iterator itr = component.getPropertyIterator();
42:                int i = 0;
43:                while (itr.hasNext()) {
44:                    Property property = (Property) itr.next();
45:                    properties[i] = PropertyFactory.buildStandardProperty(
46:                            property, false);
47:                    propertyIndexes.put(property.getName(), new Integer(i));
48:                    i++;
49:                }
50:
51:                tuplizerMapping = new ComponentEntityModeToTuplizerMapping(
52:                        component);
53:            }
54:
55:            public boolean isKey() {
56:                return isKey;
57:            }
58:
59:            public int getPropertySpan() {
60:                return propertySpan;
61:            }
62:
63:            public StandardProperty[] getProperties() {
64:                return properties;
65:            }
66:
67:            public StandardProperty getProperty(int index) {
68:                if (index < 0 || index >= propertySpan) {
69:                    throw new IllegalArgumentException(
70:                            "illegal index value for component property access [request="
71:                                    + index + ", span=" + propertySpan + "]");
72:                }
73:                return properties[index];
74:            }
75:
76:            public int getPropertyIndex(String propertyName) {
77:                Integer index = (Integer) propertyIndexes.get(propertyName);
78:                if (index == null) {
79:                    throw new HibernateException(
80:                            "component does not contain such a property ["
81:                                    + propertyName + "]");
82:                }
83:                return index.intValue();
84:            }
85:
86:            public StandardProperty getProperty(String propertyName) {
87:                return getProperty(getPropertyIndex(propertyName));
88:            }
89:
90:            public ComponentEntityModeToTuplizerMapping getTuplizerMapping() {
91:                return tuplizerMapping;
92:            }
93:
94:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.