Package javassist.tools.rmi
Class StubGenerator
- java.lang.Object
-
- javassist.tools.rmi.StubGenerator
-
- All Implemented Interfaces:
Translator
public class StubGenerator extends 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
ObjectImporterobject.
-
-
Constructor Summary
Constructors Constructor Description StubGenerator()Constructs a stub-code generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisProxyClass(String name)Returnstrueif the specified class is a proxy class recorded bymakeProxyClass().booleanmakeProxyClass(Class<?> clazz)Makes a proxy class.voidonLoad(ClassPool pool, String classname)Does nothing.voidstart(ClassPool pool)Initializes the object.
-
-
-
Method Detail
-
start
public void start(ClassPool pool) throws NotFoundException
Initializes the object. This is a method declared in javassist.Translator.- Specified by:
startin interfaceTranslator- Parameters:
pool- theClassPoolthat this translator should use.- Throws:
NotFoundException- if aCtClasscannot be found.- See Also:
Translator.start(ClassPool)
-
onLoad
public void onLoad(ClassPool pool, String classname)
Does nothing. This is a method declared in javassist.Translator.- Specified by:
onLoadin interfaceTranslator- Parameters:
pool- theClassPoolthat this translator should use.classname- the name of the class being loaded.- See Also:
Translator.onLoad(ClassPool,String)
-
isProxyClass
public boolean isProxyClass(String name)
Returnstrueif the specified class is a proxy class recorded bymakeProxyClass().- Parameters:
name- a fully-qualified class name
-
makeProxyClass
public boolean makeProxyClass(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:
falseif the proxy class has been already produced.- Throws:
CannotCompileExceptionNotFoundException
-
-