Package javassist.tools.rmi
Class StubGenerator
java.lang.Object
javassist.tools.rmi.StubGenerator
- All Implemented Interfaces:
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddMethods(CtClass proxy, Method[] ms) booleanisProxyClass(String name) Returnstrueif the specified class is a proxy class recorded bymakeProxyClass().booleanmakeProxyClass(Class<?> clazz) Makes a proxy class.private voidmodifySuperclass(CtClass orgclass) Adds a default constructor to the super classes.voidDoes nothing.private CtClassproduceProxyClass(CtClass orgclass, Class<?> orgRtClass) voidInitializes the object.private CtClassprivate CtClass[]
-
Field Details
-
fieldImporter
- See Also:
-
fieldObjectId
- See Also:
-
accessorObjectId
- See Also:
-
sampleClass
- See Also:
-
classPool
-
proxyClasses
-
forwardMethod
-
forwardStaticMethod
-
proxyConstructorParamTypes
-
interfacesForProxy
-
exceptionForProxy
-
-
Constructor Details
-
StubGenerator
public StubGenerator()Constructs a stub-code generator.
-
-
Method Details
-
start
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:
-
onLoad
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:
-
isProxyClass
Returnstrueif the specified class is a proxy class recorded bymakeProxyClass().- Parameters:
name- a fully-qualified class name
-
makeProxyClass
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
-
produceProxyClass
private CtClass produceProxyClass(CtClass orgclass, Class<?> orgRtClass) throws CannotCompileException, NotFoundException -
toCtClass
- Throws:
NotFoundException
-
toCtClass
- Throws:
NotFoundException
-
addMethods
private void addMethods(CtClass proxy, Method[] ms) throws CannotCompileException, NotFoundException -
modifySuperclass
Adds a default constructor to the super classes.
-