org.sandev.generator
Class MessageClassGenerator

java.lang.Object
  extended byorg.sandev.generator.GeneratorCommon
      extended byorg.sandev.generator.FileGeneratorBase
          extended byorg.sandev.generator.InstanceGeneratorBase
              extended byorg.sandev.generator.MessageClassGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class MessageClassGenerator
extends InstanceGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Create the messages for a struct declaration.


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
MessageClassGenerator()
           
 
Method Summary
 void delete(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Delete the message source files.
protected  void deleteFile(java.lang.String filename)
          Factors the file deletion steps
protected  com.sun.javadoc.FieldDoc[] getCollectionMessageFields(java.lang.String msgname, java.lang.String pkgname)
          Return the fields for a SandQueryMessage.
protected  java.lang.String getPackageName(com.sun.javadoc.ClassDoc cd)
          Returns the package declaration
protected  com.sun.javadoc.FieldDoc[] getQueryMessageFields(java.lang.String msgname, java.lang.String pkgname)
          Return the fields for a SandQueryMessage.
protected  java.lang.String getSrcBase(org.sandev.sandbuild.SandDecl sd)
          Return the base of the filename for where the message source should be written.
protected  com.sun.javadoc.FieldDoc[] getUpdateMessageFields(java.lang.String msgname, java.lang.String pkgname)
          Return the fields for a SandUpdateMessage.
protected  void setTransmitFields(com.sun.javadoc.FieldDoc[] fields)
          Write the fields for a SandTransmitMessage into the first elements of the given array.
 void write(org.sandev.sandbuild.SandDecl sd, java.io.File baseDir, java.lang.String extra)
          Write the message source files.
protected  void writeCollectionMessageClass(com.sun.javadoc.ClassDoc cd, java.lang.String srcbase, java.lang.String pkgname, java.lang.String structname, java.lang.String msgname, java.io.PrintStream out)
          Write the SandCollectionMessage class source file
protected  void writeCollUtilities(java.io.PrintStream out, java.lang.String basename, com.sun.javadoc.FieldDoc[] fields)
          additional utilities for SandCollectionMessage.
protected  void writeGeneralInstanceAccMut(java.io.PrintStream out, java.lang.String structname)
          additional utility for SandUpdateMessage
protected  void writeImports(java.io.PrintStream out, com.sun.javadoc.FieldDoc[] fields, java.lang.String structname, java.lang.String pkgname)
          Writes the imports we need based on the classes referenced by the fields.
protected  void writeMatchesMethod(java.io.PrintStream out, com.sun.javadoc.FieldDoc[] fields, java.lang.String classname)
          additional utility for SandQueryMessage
protected  void writeMessageClass(com.sun.javadoc.ClassDoc cd, java.lang.String srcbase, java.lang.String pkgname, java.lang.String structname, java.lang.String msgname, java.io.PrintStream out)
          Write the main SandStructMessage class source file.
protected  void writeQueryMessageClass(com.sun.javadoc.ClassDoc cd, java.lang.String srcbase, java.lang.String pkgname, java.lang.String structname, java.lang.String msgname, java.io.PrintStream out)
          Write the SandQueryMessage class source file
protected  void writeQueryUtils(java.io.PrintStream out, java.lang.String msgname, java.lang.String basename, com.sun.javadoc.FieldDoc[] fields)
          Additional utilities for SandQueryMessage.
protected  void writeSourceAccMut(java.io.PrintStream out)
          Source string accessor and mutator.
protected  void writeUpdateMessageClass(com.sun.javadoc.ClassDoc cd, java.lang.String srcbase, java.lang.String pkgname, java.lang.String structname, java.lang.String msgname, java.io.PrintStream out)
          Write the SandUpdateMessage class source file.
 
Methods inherited from class org.sandev.generator.InstanceGeneratorBase
getInstanceName, writeAccMut, writeArrayAccMut, writeArrayAppend, writeArrayClear, writeArrayContains, writeArrayGet, writeArrayInsert, writeArrayRemove, writeArrayRemoveIndex, writeArraySet, writeArraySize, writeCloneMessage, writeConstantsAndConversions, writeCoreValidityCheck, writeCtorAndInit, writeDebugDump, writeDecimalAccMut, writeDefaultValueAccessor, writeDisplayCode, writeEnumintBools, writeEnumintConsts, writeEnumintTrans, writeEquivalenceCheck, writeField, writeFieldFiltering, writeFieldsAndAccess, writeFlagAccessor, writeGenAccess, writeGenDeref, writeGenMod, writeInvalidValueAccessor, writeIsEquivalent, writeLengthAccessors, writeLongRefResolution, writeMetatypeAccess, writePrintValueAccessor, writeRangeRetrieval, writeReferenceResolution, writeSandInstanceMessageImpl, writeSandMessageImpl, writeStackOperations, writeStandardAccMut, writeStringRefResolution, writeSuperstructConversion, writeTreeAccessors, writeValidation, writeValidityCheck, writeVerbFormAccessors
 
Methods inherited from class org.sandev.generator.FileGeneratorBase
cleanup, generate, trackFileWrite
 
Methods inherited from class org.sandev.generator.GeneratorCommon
capitalize, copyfile, deletefile, filterHTMLLine, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, isBasic, isLongReferenceArray, isMessageInterface, isParentAbstract, isPrimitive, isRootStruct, isVowel, log, nextToken, pluralize, rangeEscape, removePlatformDecls, trackFileDelete, 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
 
Methods inherited from interface org.sandev.sandbuild.SandGenerator
cleanup, generate
 

Constructor Detail

MessageClassGenerator

public MessageClassGenerator()
Method Detail

write

public void write(org.sandev.sandbuild.SandDecl sd,
                  java.io.File baseDir,
                  java.lang.String extra)
           throws org.sandev.sandbuild.SandGeneratorException
Write the message source files.

Overrides:
write in class FileGeneratorBase
Throws:
org.sandev.sandbuild.SandGeneratorException

delete

public void delete(org.sandev.sandbuild.SandDecl sd,
                   java.io.File baseDir,
                   java.lang.String extra)
            throws org.sandev.sandbuild.SandGeneratorException
Delete the message source files. Note that on delete, we are using the old classes list. That means if a new struct was added, it won't have an associated ClassDoc for it, and there won't be any files for it yet either. So we are done in that case.

Overrides:
delete in class FileGeneratorBase
Throws:
org.sandev.sandbuild.SandGeneratorException

deleteFile

protected void deleteFile(java.lang.String filename)
Factors the file deletion steps


getSrcBase

protected java.lang.String getSrcBase(org.sandev.sandbuild.SandDecl sd)
Return the base of the filename for where the message source should be written. We are in the "structs" directory, and this essentially returns the corresponding "sandmessages" directory.


getPackageName

protected java.lang.String getPackageName(com.sun.javadoc.ClassDoc cd)
Returns the package declaration


setTransmitFields

protected void setTransmitFields(com.sun.javadoc.FieldDoc[] fields)
Write the fields for a SandTransmitMessage into the first elements of the given array.


getUpdateMessageFields

protected com.sun.javadoc.FieldDoc[] getUpdateMessageFields(java.lang.String msgname,
                                                            java.lang.String pkgname)
Return the fields for a SandUpdateMessage.


getQueryMessageFields

protected com.sun.javadoc.FieldDoc[] getQueryMessageFields(java.lang.String msgname,
                                                           java.lang.String pkgname)
Return the fields for a SandQueryMessage.


getCollectionMessageFields

protected com.sun.javadoc.FieldDoc[] getCollectionMessageFields(java.lang.String msgname,
                                                                java.lang.String pkgname)
Return the fields for a SandQueryMessage.


writeMessageClass

protected void writeMessageClass(com.sun.javadoc.ClassDoc cd,
                                 java.lang.String srcbase,
                                 java.lang.String pkgname,
                                 java.lang.String structname,
                                 java.lang.String msgname,
                                 java.io.PrintStream out)
                          throws org.sandev.sandbuild.SandGeneratorException
Write the main SandStructMessage class source file.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeUpdateMessageClass

protected void writeUpdateMessageClass(com.sun.javadoc.ClassDoc cd,
                                       java.lang.String srcbase,
                                       java.lang.String pkgname,
                                       java.lang.String structname,
                                       java.lang.String msgname,
                                       java.io.PrintStream out)
                                throws org.sandev.sandbuild.SandGeneratorException
Write the SandUpdateMessage class source file.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeQueryMessageClass

protected void writeQueryMessageClass(com.sun.javadoc.ClassDoc cd,
                                      java.lang.String srcbase,
                                      java.lang.String pkgname,
                                      java.lang.String structname,
                                      java.lang.String msgname,
                                      java.io.PrintStream out)
                               throws org.sandev.sandbuild.SandGeneratorException
Write the SandQueryMessage class source file

Throws:
org.sandev.sandbuild.SandGeneratorException

writeCollectionMessageClass

protected void writeCollectionMessageClass(com.sun.javadoc.ClassDoc cd,
                                           java.lang.String srcbase,
                                           java.lang.String pkgname,
                                           java.lang.String structname,
                                           java.lang.String msgname,
                                           java.io.PrintStream out)
                                    throws org.sandev.sandbuild.SandGeneratorException
Write the SandCollectionMessage class source file

Throws:
org.sandev.sandbuild.SandGeneratorException

writeImports

protected void writeImports(java.io.PrintStream out,
                            com.sun.javadoc.FieldDoc[] fields,
                            java.lang.String structname,
                            java.lang.String pkgname)
Writes the imports we need based on the classes referenced by the fields. Since we are generating from structs, we want to import the struct also.


writeGeneralInstanceAccMut

protected void writeGeneralInstanceAccMut(java.io.PrintStream out,
                                          java.lang.String structname)
additional utility for SandUpdateMessage


writeSourceAccMut

protected void writeSourceAccMut(java.io.PrintStream out)
Source string accessor and mutator.


writeMatchesMethod

protected void writeMatchesMethod(java.io.PrintStream out,
                                  com.sun.javadoc.FieldDoc[] fields,
                                  java.lang.String classname)
additional utility for SandQueryMessage


writeCollUtilities

protected void writeCollUtilities(java.io.PrintStream out,
                                  java.lang.String basename,
                                  com.sun.javadoc.FieldDoc[] fields)
additional utilities for SandCollectionMessage. The basename is the short name of the SandStructMessage class.


writeQueryUtils

protected void writeQueryUtils(java.io.PrintStream out,
                               java.lang.String msgname,
                               java.lang.String basename,
                               com.sun.javadoc.FieldDoc[] fields)
                        throws org.sandev.sandbuild.SandGeneratorException
Additional utilities for SandQueryMessage. The basename is the short name of the SandStructMessage class.

Throws:
org.sandev.sandbuild.SandGeneratorException