public abstract class AbstractGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected JavaWriter |
_out |
Constructor and Description |
---|
AbstractGenerator() |
Modifier and Type | Method and Description |
---|---|
java.lang.Class |
compile()
Compiles the Java code
|
void |
compileJava()
Compiles the class.
|
void |
generate()
Call to generate the java source.
|
void |
generateJava()
Starts generation of the Java code
|
Path |
getClassDir()
Returns the class dir for the generated class.
|
java.lang.String |
getClassName()
Returns the generated class name
|
JavaCompilerUtil |
getCompiler() |
java.lang.String |
getFullClassName()
Returns the full class name
|
GenClass |
getGenClass()
Gets the java class.
|
JavaWriter |
getOut()
Returns the java writer.
|
java.lang.String |
getPackageName()
Returns the generated package name
|
java.lang.ClassLoader |
getParentLoader()
Sets the parent class loader.
|
Path |
getSearchPath() |
java.lang.Class |
loadClass(boolean preload)
Loads the generated class.
|
java.lang.Class |
loadClass(java.lang.String fullClassName,
boolean preload)
Loads the generated class.
|
void |
popDepth()
Pops an indentation depth.
|
java.lang.Class<?> |
preload()
Try to preload the class.
|
void |
print(char ch)
Prints a character
|
void |
print(int ch)
Prints a character
|
void |
print(java.lang.String s)
Prints a string
|
void |
printClass(java.lang.Class cl)
Prints the Java represention of the class
|
protected void |
printDependList(java.util.ArrayList<PersistentDependency> depends)
Generates the class dependency code.
|
void |
println()
Prints a new line.
|
void |
println(java.lang.String s)
Prints a string with a new line
|
void |
printMethodHeader(java.lang.reflect.Method method)
Prints a method header.
|
void |
printMethodHeader(java.lang.String methodName,
java.lang.Class[] parameters,
java.lang.Class returnType,
java.lang.Class[] exn)
Prints a method header.
|
void |
printMethodHeader(java.lang.String name,
java.lang.reflect.Method method)
Prints a method header.
|
void |
printStr(java.lang.String s)
Prints a string
|
void |
pushDepth()
Pushes an indentation depth.
|
void |
setClassDir(Path workPath)
Sets the work path for the generated class.
|
void |
setFullClassName(java.lang.String fullClassName)
Sets the full generated class.
|
void |
setGenClass(GenClass genClass)
Sets the java class.
|
void |
setLoader(java.lang.ClassLoader loader)
Sets the class loader.
|
void |
setParentLoader(java.lang.ClassLoader loader)
Sets the parent class loader.
|
void |
setSearchPath(Path path)
Sets the search path.
|
protected JavaWriter _out
public void setSearchPath(Path path)
public Path getSearchPath()
public void setFullClassName(java.lang.String fullClassName)
public java.lang.String getFullClassName()
public java.lang.String getPackageName()
public java.lang.String getClassName()
public void setGenClass(GenClass genClass)
public GenClass getGenClass()
public void setParentLoader(java.lang.ClassLoader loader)
loader
- parent class loaderpublic void setLoader(java.lang.ClassLoader loader)
loader
- parent class loaderpublic java.lang.ClassLoader getParentLoader()
public void setClassDir(Path workPath)
public Path getClassDir()
public java.lang.Class<?> preload() throws java.io.IOException
java.io.IOException
public void generate() throws java.lang.Exception
java.lang.Exception
public java.lang.Class compile() throws java.lang.Exception
java.lang.Exception
public void generateJava() throws java.lang.Exception
java.lang.Exception
protected void printDependList(java.util.ArrayList<PersistentDependency> depends) throws java.io.IOException
depends
- list of Paths representing dependenciesjava.io.IOException
public void printMethodHeader(java.lang.reflect.Method method) throws java.io.IOException
method
- the method to printjava.io.IOException
public void printMethodHeader(java.lang.String name, java.lang.reflect.Method method) throws java.io.IOException
name
- the method name to printmethod
- the method to printjava.io.IOException
public void printMethodHeader(java.lang.String methodName, java.lang.Class[] parameters, java.lang.Class returnType, java.lang.Class[] exn) throws java.io.IOException
methodName
- the method name to printparam
- the method argument classesreturnType
- the return type of the methodexn
- array of exceptions thrown by the methodjava.io.IOException
public void printClass(java.lang.Class cl) throws java.io.IOException
java.io.IOException
public void compileJava() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public JavaCompilerUtil getCompiler()
public java.lang.Class loadClass(boolean preload) throws java.io.IOException
java.io.IOException
public java.lang.Class loadClass(java.lang.String fullClassName, boolean preload) throws java.io.IOException
java.io.IOException
public JavaWriter getOut()
public void pushDepth() throws java.io.IOException
java.io.IOException
public void popDepth() throws java.io.IOException
java.io.IOException
public void print(int ch) throws java.io.IOException
java.io.IOException
public void print(char ch) throws java.io.IOException
java.io.IOException
public void print(java.lang.String s) throws java.io.IOException
java.io.IOException
public void printStr(java.lang.String s) throws java.io.IOException
java.io.IOException
public void println() throws java.io.IOException
java.io.IOException
public void println(java.lang.String s) throws java.io.IOException
java.io.IOException