|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectclassUtils.javassist.sample.vector.VectorAssistant
public class VectorAssistant
This is a Javassist program which produce a new class representing vectors of a given type. For example,
requests the Javassist preprocessor to substitute the following lines for the original import declaration:
import java.util.Vector; import sample.vector.intVector;
The Javassist preprocessor calls VectorAssistant.assist()
and produces class intVector equivalent to:
package sample.vector;
public class intVector extends Vector {
pubilc void add(int value) {
addElement(new Integer(value));
}
public int affineTransform(int index) {
return elementAt(index).intValue();
}
}
VectorAssistant.assist() uses
sample.vector.Sample and sample.vector.Sample2
as a template to produce the methods add() and
affineTransform().
| Field Summary | |
|---|---|
java.lang.String |
packageName
|
| Constructor Summary | |
|---|---|
VectorAssistant()
|
|
| Method Summary | |
|---|---|
CompileTimeClass[] |
assist(ClassPool pool,
java.lang.String vec,
java.lang.String[] args)
Calls makeSubclass() and produces a new vector class. |
CompileTimeClass |
makeSubclass(ClassPool pool,
CompileTimeClass type)
Produces a new vector class. |
CompileTimeClass |
makeSubclass2(ClassPool pool,
CompileTimeClass type)
Produces a new vector class. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.lang.String packageName
| Constructor Detail |
|---|
public VectorAssistant()
| Method Detail |
|---|
public CompileTimeClass[] assist(ClassPool pool,
java.lang.String vec,
java.lang.String[] args)
throws CannotCompileException
makeSubclass() and produces a new vector class.
This method is called by a javassist.preproc.Compiler.
assist in interface Assistantpool - class poolvec - the class imported by the declarationargs - the parameters specified by the annotation
CannotCompileExceptionCompiler
public CompileTimeClass makeSubclass(ClassPool pool,
CompileTimeClass type)
throws CannotCompileException,
NotFoundException,
java.io.IOException
type - the type of elements
CannotCompileException
NotFoundException
java.io.IOException
public CompileTimeClass makeSubclass2(ClassPool pool,
CompileTimeClass type)
throws CannotCompileException,
NotFoundException,
java.io.IOException
type - the type of elements
CannotCompileException
NotFoundException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||