Class 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 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:
    Metaobject, ClassMetaobject, Reflection
    • Constructor Summary

      Constructors 
      Constructor Description
      Compiler()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Compiler

        public Compiler()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception