Javassist
Encyclopedia
Javassist is a Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

 library providing a means to manipulate the Java bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...

 of an application. In this sense Javassist provides the support for structural reflection, i.e. the ability to change the implementation
Implementation
Implementation is the realization of an application, or execution of a plan, idea, model, design, specification, standard, algorithm, or policy.-Computer Science:...

 of a class at run time.

Bytecode manipulation is performed at load-time
Loader (computing)
In computing, a loader is the part of an operating system that is responsible for loading programs. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution...

 through a provided class loader.

Uses

Javassist can be used for the following:
  • For specifying the bytecode using source code – can compile a fragment of source text online (e.g., just a single statement)
  • For Aspect Oriented Programming (AOP) – can introduce new methods into a class and insert before/after/around advice at both the caller and callee sides
  • For reflection
    Reflection (computer science)
    In computer science, reflection is the process by which a computer program can observe and modify its own structure and behavior at runtime....

     at runtime – can use a metaobject that controls method calls on base-level objects
  • For remote method invocation – can call a method on a remote object running on a web server, an alternative to Java RMI that does not need a stub compiler such as rmic

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK