|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fuin.srcgen4javassist.ByteCodeGenerator
public final class ByteCodeGenerator
Creates the byte code for a model class and has some more helper methods.
| Constructor Summary | |
|---|---|
ByteCodeGenerator()
Default constructor that uses ClassPool.getDefault(),
default class loader and default domain. |
|
ByteCodeGenerator(javassist.ClassPool pool)
Constructor with user defined class pool, default class loader and default protection domain. |
|
ByteCodeGenerator(javassist.ClassPool pool,
ClassLoader classLoader)
Constructor with user defined class pool, class loader and default protection domain. |
|
ByteCodeGenerator(javassist.ClassPool pool,
ClassLoader classLoader,
ProtectionDomain domain)
Constructor with user defined class pool, class loader and domain. |
|
| Method Summary | |
|---|---|
Class |
createClass(SgClass modelClass)
Generates the byte code for a model class and returns it. |
Object |
createInstance(Class clasz)
Creates an instance using the nor-arguments constructor and maps all exceptions into RuntimeException. |
Object |
createInstance(Class clasz,
Class[] argTypes,
Object[] initArgs)
Creates an instance mapping all exceptions into RuntimeException. |
Object |
createInstance(SgClass clasz)
Creates an instance from a model class with it's no argument constructor and maps all exceptions into RuntimeException. |
Object |
createInstance(SgClass clasz,
Class[] argTypes,
Object[] initArgs)
Creates an instance from a model class mapping all exceptions into RuntimeException. |
static ByteCodeGenerator |
createWithCurrentThreadContextClassLoader()
Creates a generator initialized with default class pool and the context class loader of the current thread. |
Class |
loadClass(SgClass modelClass)
Tries to load the model class calling Class.forName(..) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteCodeGenerator()
ClassPool.getDefault(),
default class loader and default domain.
public ByteCodeGenerator(javassist.ClassPool pool)
pool - Class pool to use - If it's null
ClassPool.getDefault()
public ByteCodeGenerator(javassist.ClassPool pool,
ClassLoader classLoader)
pool - Class pool to use - If it's null
ClassPool.getDefault()classLoader - The class loader used to load classes. If it is null, the
class loader returned by
ClassPool.getClassLoader() is used.
public ByteCodeGenerator(javassist.ClassPool pool,
ClassLoader classLoader,
ProtectionDomain domain)
pool - Class pool to use - If it's null
ClassPool.getDefault()classLoader - The class loader used to load classes. If it is null, the
class loader returned by
ClassPool.getClassLoader() is used.domain - The protection domain that classes belong to. If it is null,
the default domain created by
java.lang.ClassLoader is used.| Method Detail |
|---|
public final Class createClass(SgClass modelClass)
Class.forName(..) throws
a ClassNotFoundException). If it's known the class will be
returned instead of creating a new one.
modelClass - Model class to create the byte code for.
public Class loadClass(SgClass modelClass)
Class.forName(..).
modelClass - Model class to lookup.
public final Object createInstance(Class clasz)
RuntimeException.
clasz - Class to create an instance for.
public final Object createInstance(Class clasz,
Class[] argTypes,
Object[] initArgs)
RuntimeException.
clasz - Class to create an instance for.argTypes - Argument types of the constructor to use.initArgs - Argument values for the constructor.
public final Object createInstance(SgClass clasz,
Class[] argTypes,
Object[] initArgs)
RuntimeException.
clasz - Class to create an instance for.argTypes - Argument types of the constructor to use.initArgs - Argument values for the constructor.
public final Object createInstance(SgClass clasz)
RuntimeException.
clasz - Class to create an instance for.
public static ByteCodeGenerator createWithCurrentThreadContextClassLoader()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||