|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkoala.dynamicjava.classfile.BytecodeComponent
koala.dynamicjava.classfile.AttributeOwnerComponent
koala.dynamicjava.classfile.ClassFile
koala.dynamicjava.interpreter.ClassFactory
The instances of this class dynamically create java classes
Field Summary |
Fields inherited from class koala.dynamicjava.classfile.AttributeOwnerComponent |
accessFlags, attributes |
Fields inherited from class koala.dynamicjava.classfile.BytecodeComponent |
constantPool, nameIndex |
Constructor Summary | |
ClassFactory(int af,
java.lang.String name,
java.lang.String sname,
java.lang.Class interp,
java.lang.Class except,
java.lang.String clid)
Creates a new class factory for an innerclass |
Method Summary | |
void |
addConstantBooleanField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.Boolean v)
Adds a constant boolean field to the class. |
void |
addConstantDoubleField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.Double v)
Adds a constant double field to the class. |
void |
addConstantFloatField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.Float v)
Adds a constant float field to the class. |
void |
addConstantIntField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.Integer v)
Adds a constant int field to the class. |
void |
addConstantLongField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.Long v)
Adds a constant long field to the class. |
void |
addConstantStringField(int af,
java.lang.String ft,
java.lang.String nm,
java.lang.String v)
Adds a constant string field to the class. |
java.lang.String |
addConstructor(int af,
java.lang.String[] pt,
java.lang.String[] ex,
java.lang.String sup,
java.lang.String[] st)
Adds a constructor to the class. |
void |
addField(int af,
java.lang.String ft,
java.lang.String nm)
Adds a field to the class. |
InnerClassesEntry |
addInnerClassesEntry()
Adds an InnerClasses entry |
java.lang.String |
addMethod(int af,
java.lang.String rt,
java.lang.String nm,
java.lang.String[] pt,
java.lang.String[] ex)
Adds a method to the class. |
void |
addSuperMethodAccessor(int af,
java.lang.String rt,
java.lang.String nm,
java.lang.String[] pt,
java.lang.String[] ex)
Adds a method that calls the supermethod of the given method |
java.lang.String |
createClassInitializer()
Creates the class initializer. |
byte[] |
getByteCode()
Returns the generated class |
static java.lang.String |
getMethodIdentifier(java.lang.String cname,
java.lang.String mname,
java.lang.String[] pnames,
java.lang.String clid)
Computes a method identifier. |
Methods inherited from class koala.dynamicjava.classfile.ClassFile |
addInterface, createField, createMethod, getConstantPool, setAbstract, setFinal, setInnerClassesAttribute, setInterface, setPublic, setSuper, write |
Methods inherited from class koala.dynamicjava.classfile.AttributeOwnerComponent |
setAccessFlags, setSyntheticAttribute |
Methods inherited from class koala.dynamicjava.classfile.BytecodeComponent |
write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassFactory(int af, java.lang.String name, java.lang.String sname, java.lang.Class interp, java.lang.Class except, java.lang.String clid)
af
- the access flagsname
- the name of the class to createsname
- the name of the superclassinterp
- the class of the interpreter used to evaluate the body of
the methods.
It must implement methods with the following signatures:public static Object[] interpretArguments
(String key, Object[] args)
public static Object invokeMethod
(String key, Object obj, Object[] args)
except
- the class of the exception used to manage exception throwing.
It must implement a method with the following signature:public Throwable getException()
.clid
- the class loader identifierMethod Detail |
public static java.lang.String getMethodIdentifier(java.lang.String cname, java.lang.String mname, java.lang.String[] pnames, java.lang.String clid)
cname
- the name of the classmname
- the name of the methodpnames
- the names of the parameter classesclid
- the classloader identifierpublic java.lang.String createClassInitializer()
public java.lang.String addConstructor(int af, java.lang.String[] pt, java.lang.String[] ex, java.lang.String sup, java.lang.String[] st)
af
- the access flagspt
- the parameters typesex
- the exceptions thrownsup
- the name of the super constructorst
- the initialization method parameter types
public void addField(int af, java.lang.String ft, java.lang.String nm)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantIntField(int af, java.lang.String ft, java.lang.String nm, java.lang.Integer v)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantLongField(int af, java.lang.String ft, java.lang.String nm, java.lang.Long v)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantFloatField(int af, java.lang.String ft, java.lang.String nm, java.lang.Float v)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantDoubleField(int af, java.lang.String ft, java.lang.String nm, java.lang.Double v)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantBooleanField(int af, java.lang.String ft, java.lang.String nm, java.lang.Boolean v)
af
- the access flagsft
- the field typenm
- the field namepublic void addConstantStringField(int af, java.lang.String ft, java.lang.String nm, java.lang.String v)
af
- the access flagsft
- the field typenm
- the field namepublic InnerClassesEntry addInnerClassesEntry()
public void addSuperMethodAccessor(int af, java.lang.String rt, java.lang.String nm, java.lang.String[] pt, java.lang.String[] ex)
af
- the access flagsrt
- the return typenm
- the name of the methodpt
- the parameters typesex
- the exceptions thrownpublic java.lang.String addMethod(int af, java.lang.String rt, java.lang.String nm, java.lang.String[] pt, java.lang.String[] ex)
af
- the access flagsrt
- the return typenm
- the name of the methodpt
- the parameters typesex
- the exceptions thrown
public byte[] getByteCode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |