org.sandev.generator
Class AggregateMappedGeneratorBase

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.AggregateGeneratorBase
          extended by org.sandev.generator.AggregateMappedGeneratorBase
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator
Direct Known Subclasses:
JDBCPersisterGenerator, SQLClearDatabaseGenerator, SQLQueryProcessorGenerator, SQLReinitConverterGenerator, SQLSchemaVerifierGenerator, SQLUpdateProcessorGenerator, TableKeyCounterGenerator

public class AggregateMappedGeneratorBase
extends org.sandev.generator.AggregateGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Base class for generators creating a single aggregate file using a StructMapper. This base class loads the StructMapper declared in the build or the default mapper if a valid mapper class was not specified.


Field Summary
protected  org.sandev.generator.StructMapper structmap
          The mappings we are using.
protected  java.lang.String structPrefix
          The prefix to be applied to all mapped struct names.
 
Fields inherited from class org.sandev.generator.AggregateGeneratorBase
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
AggregateMappedGeneratorBase()
           
 
Method Summary
protected  java.lang.String getMappedFieldName(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          Returns the mapped name for the field.
protected  java.lang.String getMappedFieldRelation(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          Returns the mapped name for the relationship between the struct and the reference array field values.
protected  java.lang.String getMappedFieldRelationChild(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          In the relation between the struct and the reference array field values, return the name of the field representing the array field value.
protected  java.lang.String getMappedFieldRelationIndex(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          In the relation between the struct and the reference array field values, return the name of the field representing the ordering information for the array values.
protected  java.lang.String getMappedFieldRelationParent(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          In the relation between the struct and the reference array field values, return the name of the field representing the struct instance.
protected  java.lang.String getMappedFieldType(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.FieldDoc field)
          Returns the mapped type for the field.
protected  java.lang.String getMappedStructName(com.sun.javadoc.ClassDoc struct)
          Return the mapped struct name.
protected  java.lang.String getMappedStructName(com.sun.javadoc.ClassDoc struct, com.sun.javadoc.ClassDoc[] path)
          Return the mapped struct name, using the next level down in the given path if it the struct is abstract.
protected  void loadStructMapper()
          Load our structmap sandpersist declaration.
protected  org.sandev.generator.StructMapper loadStructMapper(java.lang.String mapname)
          Return a new instance of the specified StructMapper if possible.
 
Methods inherited from class org.sandev.generator.AggregateGeneratorBase
addSandAttrValToDecls, cleanup, cleanupSecondaryFiles, generate, getExtra, getFileSpec, setExtra, writeFile, writeSecondaryFiles
 
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
 
Methods inherited from interface org.sandev.sandbuild.SandGenerator
cleanup, generate
 

Field Detail

structmap

protected org.sandev.generator.StructMapper structmap
The mappings we are using. Initialized by loadStructMapper.


structPrefix

protected java.lang.String structPrefix
The prefix to be applied to all mapped struct names. Initialized by loadStructMapper.

Constructor Detail

AggregateMappedGeneratorBase

public AggregateMappedGeneratorBase()
Method Detail

loadStructMapper

protected void loadStructMapper()
                         throws org.sandev.sandbuild.SandGeneratorException
Load our structmap sandpersist declaration. This method is normally called from the writeFile override.

In the absence of an explicit declaration, log a warning and load the default. Using the default is fine, but it's much clearer if the deployment declares that explicitly. That way if the default gets used when it shouldn't be, the build log will show what happened.

Throws:
org.sandev.sandbuild.SandGeneratorException

loadStructMapper

protected org.sandev.generator.StructMapper loadStructMapper(java.lang.String mapname)
                                                      throws org.sandev.sandbuild.SandGeneratorException
Return a new instance of the specified StructMapper if possible. If the specified mapper couldn't be loaded, throw an exception - the developer probably mistyped the mapper name, and doesn't want to fall back to the default.

Throws:
org.sandev.sandbuild.SandGeneratorException

getMappedStructName

protected java.lang.String getMappedStructName(com.sun.javadoc.ClassDoc struct)
Return the mapped struct name.


getMappedStructName

protected java.lang.String getMappedStructName(com.sun.javadoc.ClassDoc struct,
                                               com.sun.javadoc.ClassDoc[] path)
Return the mapped struct name, using the next level down in the given path if it the struct is abstract. The path must contain the given struct object.


getMappedFieldName

protected java.lang.String getMappedFieldName(com.sun.javadoc.ClassDoc struct,
                                              com.sun.javadoc.FieldDoc field)
Returns the mapped name for the field.


getMappedFieldType

protected java.lang.String getMappedFieldType(com.sun.javadoc.ClassDoc struct,
                                              com.sun.javadoc.FieldDoc field)
Returns the mapped type for the field.


getMappedFieldRelation

protected java.lang.String getMappedFieldRelation(com.sun.javadoc.ClassDoc struct,
                                                  com.sun.javadoc.FieldDoc field)
Returns the mapped name for the relationship between the struct and the reference array field values.


getMappedFieldRelationParent

protected java.lang.String getMappedFieldRelationParent(com.sun.javadoc.ClassDoc struct,
                                                        com.sun.javadoc.FieldDoc field)
In the relation between the struct and the reference array field values, return the name of the field representing the struct instance. This would typically return something like "parent".


getMappedFieldRelationChild

protected java.lang.String getMappedFieldRelationChild(com.sun.javadoc.ClassDoc struct,
                                                       com.sun.javadoc.FieldDoc field)
In the relation between the struct and the reference array field values, return the name of the field representing the array field value. This is typically return something like "child".


getMappedFieldRelationIndex

protected java.lang.String getMappedFieldRelationIndex(com.sun.javadoc.ClassDoc struct,
                                                       com.sun.javadoc.FieldDoc field)
In the relation between the struct and the reference array field values, return the name of the field representing the ordering information for the array values. This would typically return something like "index".