Class Compiler
- java.lang.Object
-
- javassist.tools.reflect.Compiler
-
public class Compiler extends java.lang.Object
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 isjavassit.reflect.Metaobject
.-c classname
: specifies the class of the class metaobjects associated with instances of the class followed by this option. The default isjavassit.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
, andCow.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:
Metaobject
,ClassMetaobject
,Reflection
-
-
Constructor Summary
Constructors Constructor Description Compiler()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
help(java.io.PrintStream out)
static void
main(java.lang.String[] args)
private static int
parse(java.lang.String[] args, CompiledClass[] result)
private static void
processClasses(CompiledClass[] entries, int n)
-
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
processClasses
private static void processClasses(CompiledClass[] entries, int n) throws java.lang.Exception
- Throws:
java.lang.Exception
-
parse
private static int parse(java.lang.String[] args, CompiledClass[] result)
-
help
private static void help(java.io.PrintStream out)
-
-