Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javassist.rmi
Class StubGenerator

    java.lang.Object
      |
      +--javassist.rmi.StubGenerator

All Implemented Interfaces:
  Translator

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
`StubGenerator()` Constructs a stub-code generator.

Method Summary
`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` | `onWrite(ClassPool pool, java.lang.String classname)` Is invoked by a `ClassPool` for notifying that a class is written out to an output stream.
`void` | `start(ClassPool pool)` Is a method declared in javassist.Translator.

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

### start

    public void start(ClassPool pool)
               throws NotFoundException

  Is a method declared in javassist.Translator.

  Specified by:
    `start` in interface `Translator`
  Parameters:
    `pool` - the `ClassPool` that this translator is attached to.
    `NotFoundException`
  See Also:
    `Translator.start(ClassPool)`

### onWrite

    public void onWrite(ClassPool pool,
                        java.lang.String classname)

  Description copied from interface: `Translator`
  Is invoked by a `ClassPool` for notifying that a class is written out to an output stream.

  If CtClass.frozen() is true, that is, if the class has been already modified and written, then onWrite() is not invoked.

  Specified by:
    `onWrite` in interface `Translator`
  Parameters:
    `pool` - the `ClassPool` that this translator is attached to.
    `classname` - a fully-qualified class name
  See Also:
    `ClassPool.writeFile(String)`, `ClassPool.writeFile(String, String)`, `ClassPool.write(String)`, `ClassPool.write(String,DataOutputStream)`

### isProxyClass

    public boolean isProxyClass(java.lang.String name)

  Returns `true` if the specified class is a proxy class recorded by `makeProxyClass()`.

  Parameters:
    `name` - a fully-qualified class name

### makeProxyClass

    public boolean makeProxyClass(java.lang.Class clazz)
                           throws CannotCompileException,
                                  NotFoundException

  Makes a proxy class. The produced class is substituted for the original class.

  Parameters:
    `clazz` - the class referenced through the proxy class.
  Returns:
    `false` if the proxy class has been already produced.
    `CannotCompileException`
    `NotFoundException`

Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Javassist, a Java-bytecode translator toolkit. Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved.