|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sandev.generator.GeneratorCommon
org.sandev.generator.FileGeneratorBase
Optional base class for generators which operate only on files, without
side effects or merge requirements. With a file generator, cleanup
consists only of deleting the source which was previously generated.
If your generator has side-effects (like analyzing/altering a generated
database table), or requires merge (like version compatibility testing
of an XML schema), then you need to handle your own top level
generate/cleanup methods.
However if your generator handles cleanup simply by deleting the
files it previously wrote, then it can extend this base to use the
simplified interface provided here. Essentially this provides the
infrastructure to iterate through the declarations, calling delete
for any deleted declarations or on cleanup, and calling generate if
either the decl or the generator was changed.
This class is set up for generators which are tied to single
struct or node declarations. Use AggregateGeneratorBase
for file-based generators that work across many declarations to
write a single file.
| Field Summary |
| Fields inherited from class org.sandev.generator.GeneratorCommon |
CONTEXT_CONFIGURATION, CONTEXT_CONTROL, CONTEXT_FRAMEWORK, CONTEXT_MESSAGING, CONTEXT_PERSISTENCE, CONTEXT_UI, DEFAULT_LINE_LENGTH, MESSAGE_INTERFACES |
| Constructor Summary | |
FileGeneratorBase()
|
|
| Method Summary | |
void |
cleanup(org.sandev.sandbuild.SandDecl[] decls,
java.io.File baseDir,
boolean changed,
java.lang.String extra)
Nuke the source files we generated. |
void |
delete(org.sandev.sandbuild.SandDecl decl,
java.io.File baseDir,
java.lang.String extra)
Delete what you wrote, calling trackFileDelete for each file deleted. |
void |
generate(org.sandev.sandbuild.SandDecl[] decls,
java.io.File baseDir,
boolean changed,
java.util.Collection dirtyFiles,
java.lang.String extra)
Write the NodeBase source files if the declaration changed. |
void |
trackFileWrite(java.lang.String filespec)
Track the fact that we are writing the specified file. |
void |
write(org.sandev.sandbuild.SandDecl decl,
java.io.File baseDir,
java.lang.String extra)
Write your source code, calling trackFileWrite for each file written. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public FileGeneratorBase()
| Method Detail |
public void generate(org.sandev.sandbuild.SandDecl[] decls,
java.io.File baseDir,
boolean changed,
java.util.Collection dirtyFiles,
java.lang.String extra)
throws org.sandev.sandbuild.SandGeneratorException
generate in interface org.sandev.sandbuild.SandGeneratororg.sandev.sandbuild.SandGeneratorException
public void cleanup(org.sandev.sandbuild.SandDecl[] decls,
java.io.File baseDir,
boolean changed,
java.lang.String extra)
throws org.sandev.sandbuild.SandGeneratorException
cleanup in interface org.sandev.sandbuild.SandGeneratororg.sandev.sandbuild.SandGeneratorExceptionpublic void trackFileWrite(java.lang.String filespec)
trackFileWrite in class GeneratorCommon
public void write(org.sandev.sandbuild.SandDecl decl,
java.io.File baseDir,
java.lang.String extra)
throws org.sandev.sandbuild.SandGeneratorException
org.sandev.sandbuild.SandGeneratorException
public void delete(org.sandev.sandbuild.SandDecl decl,
java.io.File baseDir,
java.lang.String extra)
throws org.sandev.sandbuild.SandGeneratorException
org.sandev.sandbuild.SandGeneratorException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||