|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.moesol.generator.ClassGenerator
public abstract class ClassGenerator
Abstract base class for code generators
Constructor Summary | |
---|---|
ClassGenerator(Class clazz,
boolean quiet,
TranslationContext map)
|
Method Summary | |
---|---|
static Class |
ClassForName(String className)
Helper |
void |
cni_forward(Writer out)
Called from class templates |
protected Writer |
createClassOutput(String output_directory)
Create an output file suitable for return from createClassOutput. |
protected Template |
createClassTemplate()
Create an instance of Template that is configured to callback onto this. |
protected abstract ClassGeneratorVisitor |
createClassVisitor(Writer out)
Template method |
protected void |
extendClassProperties(Properties p)
Template method |
protected String |
findClassTemplate(String prefix,
String type)
Finds the translation template using a standard search. |
void |
generate(String output_directory)
|
protected String |
getClassDirectory()
|
protected String |
getClassDirectory(Class a_class)
|
protected abstract String |
getFileSuffix()
Template method |
protected abstract String |
getTemplateName()
Template method |
TranslationContext |
getTranslationContext()
|
protected static String |
getTransProperty(String key)
Helper |
void |
merge_import(Writer out)
Called from class templats |
void |
merge(Writer out)
Called from class templats |
protected boolean |
shouldGenerate()
Template method, default implementation returns true for public classes and interfaces. |
void |
visit(Writer out)
Called from class templates |
void |
visit(Writer out,
String arg)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassGenerator(Class clazz, boolean quiet, TranslationContext map)
Method Detail |
---|
protected boolean shouldGenerate()
protected void extendClassProperties(Properties p) throws ApplyException
ApplyException
protected abstract String getTemplateName() throws ApplyException
ApplyException
protected abstract ClassGeneratorVisitor createClassVisitor(Writer out) throws ApplyException
ApplyException
protected abstract String getFileSuffix()
public static Class ClassForName(String className) throws ApplyException
ApplyException
public void generate(String output_directory) throws ApplyException
ApplyException
protected Writer createClassOutput(String output_directory) throws IOException
If the output_directory
does not exist then this
method will throw a java.io.IOException.
output_directory
- a string defining which directory to create
the output file in.
IOException
protected String getClassDirectory()
protected String getClassDirectory(Class a_class)
a_class
parameter.protected String findClassTemplate(String prefix, String type) throws ApplyException
For example, if the prefix is "java.class" and the class
being generated is "com.moebiussolutions.test.Test" that
extends from "com.moebiussolutions.test.TestSuper", then the
search is:
"java.class.com.moebiussolutions.test.Test",
"java.class.super.com.moebiussolutions.test.TestSuper",
"java.class"
ApplyException
protected Template createClassTemplate() throws ApplyException
ApplyException
protected static String getTransProperty(String key) throws ApplyException
ApplyException
public TranslationContext getTranslationContext()
public void cni_forward(Writer out) throws ApplyException
ApplyException
public void visit(Writer out) throws ApplyException
ApplyException
public void visit(Writer out, String arg) throws ApplyException
ApplyException
public void merge(Writer out) throws ApplyException
ApplyException
public void merge_import(Writer out) throws ApplyException
ApplyException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |