public class Compiler
extends java.lang.Object
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.
Metaobject
,
ClassMetaobject
,
Reflection
Constructor and Description |
---|
Compiler() |
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args) |
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.