Class StubGenerator

  • All Implemented Interfaces:

    public class StubGenerator
    extends java.lang.Object
    implements Translator
    A stub-code generator. It is used for producing a proxy class.

    The proxy class for class A is as follows:

    public class A implements Proxy, Serializable {
       private ObjectImporter importer;
       private int objectId;
       public int _getObjectId() { return objectId; }
       public A(ObjectImporter oi, int id) {
         importer = oi; objectId = id;
       ... the same methods that the original class A declares ...

    Instances of the proxy class is created by an ObjectImporter object.

    • Constructor Summary

      Constructor Description
      Constructs a stub-code generator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isProxyClass​(java.lang.String name)
      Returns true if the specified class is a proxy class recorded by makeProxyClass().
      boolean makeProxyClass​(java.lang.Class<?> clazz)
      Makes a proxy class.
      void onLoad​(ClassPool pool, java.lang.String classname)
      Does nothing.
      void start​(ClassPool pool)
      Initializes the object.
      • Methods inherited from class java.lang.Object

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

      • StubGenerator

        public StubGenerator()
        Constructs a stub-code generator.
    • Method Detail

      • onLoad

        public void onLoad​(ClassPool pool,
                           java.lang.String classname)
        Does nothing. This is a method declared in javassist.Translator.
        Specified by:
        onLoad in interface Translator
        pool - the ClassPool that this translator should use.
        classname - the name of the class being loaded.
        See Also:
      • isProxyClass

        public boolean isProxyClass​(java.lang.String name)
        Returns true if the specified class is a proxy class recorded by makeProxyClass().
        name - a fully-qualified class name