classUtils.javassist
Interface Translator

All Known Implementing Classes:
Evolution, Reflection, StubGenerator

public interface Translator

An observer of ClassPool. The users can define a class implementing this interface and attach an instance of that class to a ClassPool object so that it can translate a class file when the class file is loaded into the JVM, for example.

See Also:
ClassPool.ClassPool(ClassPool,Translator), ClassPool.getDefault(Translator)

Method Summary
 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 invoked by a ClassPool for initialization when the object is attached to a ClassPool object.
 

Method Detail

start

void start(ClassPool pool)
           throws NotFoundException,
                  CannotCompileException
Is invoked by a ClassPool for initialization when the object is attached to a ClassPool object.

Parameters:
pool - the ClassPool that this translator is attached to.
Throws:
NotFoundException
CannotCompileException
See Also:
ClassPool.ClassPool(ClassPool,Translator), ClassPool.getDefault(Translator)

onWrite

void onWrite(ClassPool pool,
             java.lang.String classname)
             throws NotFoundException,
                    CannotCompileException
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.

Parameters:
pool - the ClassPool that this translator is attached to.
classname - a fully-qualified class name
Throws:
NotFoundException
CannotCompileException
See Also:
ClassPool.writeFile(String), ClassPool.writeFile(String, String), ClassPool.write(String), ClassPool.write(String,DataOutputStream)