Top Description Constructors Methods
javassist.tools.reflect

public Class Compiler

Additional top-level class in compilation unit: CompiledClass.

extends Object
Class Inheritance
Imports
java.io.PrintStream, javassist.ClassPool, .CtClass

A bytecode translator for reflection.

This translator directly modifies class files on a local disk so that the classes represented by those class files are reflective. After the modification, the class files can be run with the standard JVM without javassist.tools.reflect.Loader or any other user-defined class loader.

The modified class files are given as the command-line parameters, which are a sequence of fully-qualified class names followed by options:

-m classname : specifies the class of the metaobjects associated with instances of the class followed by this option. The default is javassit.reflect.Metaobject.

-c classname : specifies the class of the class metaobjects associated with instances of the class followed by this option. The default is javassit.reflect.ClassMetaobject.

If a class name is not followed by any options, the class indicated by that class name is not reflective.

For example,

% java Compiler Dog -m MetaDog -c CMetaDog Cat -m MetaCat Cow

modifies class files Dog.class, Cat.class, and Cow.class. The metaobject of a Dog object is a MetaDog object and the class metaobject is a CMetaDog object. The metaobject of a Cat object is a MetaCat object but the class metaobject is a default one. Cow objects are not reflective.

Note that if the super class is also made reflective, it must be done before the sub class.

See Also
javassist.tools.reflect.Metaobject, javassist.tools.reflect.ClassMetaobject, javassist.tools.reflect.Reflection

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
public static void
main(String[] args)

private static int
parse(String[] args, CompiledClass[] result)

private static void
processClasses(CompiledClass[] entries, int n)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Compilerback to summary
public Compiler()

Method Detail

helpback to summary
private static void help(PrintStream out)
mainback to summary
public static void main(String[] args) throws Exception
parseback to summary
private static int parse(String[] args, CompiledClass[] result)
processClassesback to summary
private static void processClasses(CompiledClass[] entries, int n) throws Exception