Source Code Cross Referenced for StdInstantiatorStrategy.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » objenesis » strategy » 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 » Rule Engine » drolls Rule Engine » org.drools.objenesis.strategy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.drools.objenesis.strategy;
02:
03:        import org.drools.objenesis.instantiator.ObjectInstantiator;
04:        import org.drools.objenesis.instantiator.gcj.GCJInstantiator;
05:        import org.drools.objenesis.instantiator.jrockit.JRockit131Instantiator;
06:        import org.drools.objenesis.instantiator.jrockit.JRockitLegacyInstantiator;
07:        import org.drools.objenesis.instantiator.sun.Sun13Instantiator;
08:        import org.drools.objenesis.instantiator.sun.SunReflectionFactoryInstantiator;
09:
10:        /**
11:         * Guess the best instantiator for a given class. The instantiator will instantiate the class
12:         * without calling any constructor. Currently, the selection doesn't depend on the class. It relies
13:         * on the
14:         * <ul>
15:         * <li>JVM version</li>
16:         * <li>JVM vendor</li>
17:         * <li>JVM vendor version</li>
18:         * </ul>
19:         * However, instantiators are stateful and so dedicated to their class.
20:         * 
21:         * @see ObjectInstantiator
22:         */
23:        public class StdInstantiatorStrategy extends BaseInstantiatorStrategy {
24:
25:            /**
26:             * Return an {@link ObjectInstantiator} allowing to create instance without any constructor being
27:             * called.
28:             * 
29:             * @param type Class to instantiate
30:             * @return The ObjectInstantiator for the class
31:             */
32:            public ObjectInstantiator newInstantiatorOf(final Class type) {
33:
34:                if (JVM_NAME.startsWith(SUN)) {
35:                    if (VM_VERSION.startsWith("1.3")) {
36:                        return new Sun13Instantiator(type);
37:                    }
38:                } else if (JVM_NAME.startsWith(JROCKIT)) {
39:                    if (VM_VERSION.startsWith("1.3")) {
40:                        return new JRockit131Instantiator(type);
41:                    } else if (VM_VERSION.startsWith("1.4")) {
42:                        // JRockit vendor version will be RXX where XX is the version
43:                        // Versions prior to 26 need special handling
44:                        // From R26 on, java.vm.version starts with R
45:                        if (!VENDOR_VERSION.startsWith("R")) {
46:                            // On R25.1 and R25.2, ReflectionFactory should work. Otherwise, we must use the
47:                            // Legacy instantiator.
48:                            if (VM_INFO == null || !VM_INFO.startsWith("R25.1")
49:                                    || !VM_INFO.startsWith("R25.2")) {
50:                                return new JRockitLegacyInstantiator(type);
51:                            }
52:                        }
53:                    }
54:                } else if (JVM_NAME.startsWith(GNU)) {
55:                    return new GCJInstantiator(type);
56:                }
57:
58:                // Fallback instantiator, should work with:
59:                // - Java Hotspot version 1.4 and higher
60:                // - JRockit 1.4-R26 and higher
61:                // - IBM and Hitachi JVMs
62:                // ... might works for others so we just give it a try
63:                return new SunReflectionFactoryInstantiator(type);
64:            }
65:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.