javassist.tools.reflect

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 » Byte Code » Javassist » javassist.tools.reflect 
javassist.tools.reflect
Runtime Behavioral Reflection.

(also recently known as interceptors or AOP?)

This package enables a metaobject to trap method calls and field accesses on a regular Java object. It provides a class Reflection, which is a main module for implementing runtime behavioral reflection. It also provides a class Loader and Compiler as utilities for dynamically or statically translating a regular class into a reflective class.

An instance of the reflective class is associated with a runtime metaobject and a runtime class metaobject, which control the behavior of that instance. The runtime metaobject is created for every (base-level) instance but the runtime class metaobject is created for every (base-level) class. Metaobject is the root class of the runtime metaobject and ClassMetaobject is the root class of the runtime class metaobject.

This package is provided as a sample implementation of the reflection mechanism with Javassist. All the programs in this package uses only the regular Javassist API; they never call any hidden methods.

The most significant class in this package is Reflection. See the description of this class first.

Java Source File NameTypeComment
CannotCreateException.javaClass Signals that ClassMetaobject.newInstance() fails.
CannotInvokeException.javaClass Thrown when method invocation using the reflection API has thrown an exception.
CannotReflectException.javaClass Thrown by makeReflective() in Reflection when there is an attempt to reflect a class that is either an interface or a subclass of either ClassMetaobject or Metaobject.
ClassMetaobject.javaClass A runtime class metaobject.

A ClassMetaobject is created for every class of reflective objects.

Compiler.javaClass
Loader.javaClass A class loader for reflection.

To run a program, say MyApp, including a reflective class, you must write a start-up program as follows:

     public class Main {
     public static void main(String[] args) throws Throwable {
     javassist.tools.reflect.Loader cl
     = (javassist.tools.reflect.Loader)Main.class.getClassLoader();
     cl.makeReflective("Person", "MyMetaobject",
     "javassist.tools.reflect.ClassMetaobject");
     cl.run("MyApp", args);
     }
     }
     

Then run this program as follows:

    % java javassist.tools.reflect.Loader Main arg1, ...

This command runs Main.main() with arg1, ... and Main.main() runs MyApp.main() with arg1, ... The Person class is modified to be a reflective class.

Metalevel.javaInterface An interface to access a metaobject and a class metaobject.
Metaobject.javaClass A runtime metaobject.

A Metaobject is created for every object at the base level.

Reflection.javaClass The class implementing the behavioral reflection mechanism.

If a class is reflective, then all the method invocations on every instance of that class are intercepted by the runtime metaobject controlling that instance.

Sample.javaClass A template used for defining a reflective class.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.