Package javassist
Interface Translator
- All Known Implementing Classes:
Reflection,StubGenerator
public interface Translator
An observer of
Loader.
The users can define a class implementing this
interface and attach an instance of that class to a
Loader object so that it can translate a class file
when the class file is loaded into the JVM.-
Method Summary
-
Method Details
-
start
Is invoked by aLoaderfor initialization when the object is attached to theLoaderobject. This method can be used for getting (for caching) someCtClassobjects that will be accessed inonLoad()inTranslator.- Parameters:
pool- theClassPoolthat this translator should use.- Throws:
NotFoundException- if aCtClasscannot be found.CannotCompileException- if the initialization by this method fails.- See Also:
-
onLoad
Is invoked by aLoaderfor notifying that a class is loaded. TheLoadercallspool.get(classname).toBytecode()
to read the class file afteronLoad()returns.classnamemay be the name of a class that has not been created yet. If so,onLoad()must create that class so that theLoadercan read it afteronLoad()returns.- Parameters:
pool- theClassPoolthat this translator should use.classname- the name of the class being loaded.- Throws:
NotFoundException- if aCtClasscannot be found.CannotCompileException- if the code transformation by this method fails.- See Also:
-