org.sandev.generator
Class AggregateGeneratorBase

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.AggregateGeneratorBase
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator
Direct Known Subclasses:
InstClassEnumGenerator, ProtocolBufferGenerator

public class AggregateGeneratorBase
extends GeneratorCommon
implements org.sandev.sandbuild.SandGenerator

Optional base class for generators which operate only on a single aggregate file, without side effects or merge requirements. This is similar to FileGeneratorBase, see the comments there for more details on appropriate use.


Field Summary
protected  java.lang.String extra
           
 
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
AggregateGeneratorBase()
           
 
Method Summary
static org.sandev.sandbuild.SandDecl[] addSandAttrValToDecls(org.sandev.sandbuild.SandDecl[] decls)
          SandAttrVal is treated as if it had a corresponding struct declaration for some purposes.
 void cleanup(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.lang.String extra)
          Nuke the aggregate source file
 void cleanupSecondaryFiles(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir)
          Clean up whatever was done in writeSecondaryFiles
 void generate(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, boolean changed, java.util.Collection dirtyFiles, java.lang.String extra)
          Write the aggregate source file
 java.lang.String getExtra()
          accessor for extra
protected  java.lang.String getFileSpec(java.io.File baseDir)
          Return the full file specification we of the file we are generating.
 void setExtra(java.lang.String val)
          mutator for extra
protected  void writeFile(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write the file.
 void writeSecondaryFiles(org.sandev.sandbuild.SandDecl[] decls, java.io.File baseDir, java.util.Collection dirtyFiles)
          Create supplemental documentation or other supporting files.
 
Methods inherited from class org.sandev.generator.GeneratorCommon
capitalize, copyfile, deletefile, filterHTMLLine, findStructDeclByShortname, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, hasSubStructs, isArray, isBasic, isLongReferenceArray, isMessageInterface, isParentAbstract, isPrimitive, isRootStruct, isVowel, log, nextToken, pluralize, rangeEscape, removePlatformDecls, trackFileDelete, trackFileWrite, uncapitalize, writeDefaultCtor, writeDescription, writeHTMLContents, writeMessageImports, writeSectionName, writeStandardCommentID, writeXHTMLFooter, writeXHTMLFooter, writeXHTMLHeader, writeXHTMLHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extra

protected java.lang.String extra
Constructor Detail

AggregateGeneratorBase

public AggregateGeneratorBase()
Method Detail

getExtra

public java.lang.String getExtra()
accessor for extra


setExtra

public void setExtra(java.lang.String val)
mutator for extra


generate

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
Write the aggregate source file

Specified by:
generate in interface org.sandev.sandbuild.SandGenerator
Throws:
org.sandev.sandbuild.SandGeneratorException

cleanup

public void cleanup(org.sandev.sandbuild.SandDecl[] decls,
                    java.io.File baseDir,
                    boolean changed,
                    java.lang.String extra)
             throws org.sandev.sandbuild.SandGeneratorException
Nuke the aggregate source file

Specified by:
cleanup in interface org.sandev.sandbuild.SandGenerator
Throws:
org.sandev.sandbuild.SandGeneratorException

getFileSpec

protected java.lang.String getFileSpec(java.io.File baseDir)
                                throws org.sandev.sandbuild.SandGeneratorException
Return the full file specification we of the file we are generating. Subclasses must override this method to return the aggregate file they are generating.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeFile

protected void writeFile(java.io.PrintStream out,
                         org.sandev.sandbuild.SandDecl[] decls)
                  throws org.sandev.sandbuild.SandGeneratorException
Write the file. Subclasses override this method to do their work.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeSecondaryFiles

public void writeSecondaryFiles(org.sandev.sandbuild.SandDecl[] decls,
                                java.io.File baseDir,
                                java.util.Collection dirtyFiles)
                         throws org.sandev.sandbuild.SandGeneratorException
Create supplemental documentation or other supporting files.

Throws:
org.sandev.sandbuild.SandGeneratorException

cleanupSecondaryFiles

public void cleanupSecondaryFiles(org.sandev.sandbuild.SandDecl[] decls,
                                  java.io.File baseDir)
                           throws org.sandev.sandbuild.SandGeneratorException
Clean up whatever was done in writeSecondaryFiles

Throws:
org.sandev.sandbuild.SandGeneratorException

addSandAttrValToDecls

public static org.sandev.sandbuild.SandDecl[] addSandAttrValToDecls(org.sandev.sandbuild.SandDecl[] decls)
SandAttrVal is treated as if it had a corresponding struct declaration for some purposes. At one point it really did, but it got to be too much hassle. At any rate, there are times when we need to add a decl back in as if it were still a struct.