public abstract class BaseDMWGenerator extends Object implements DarkMatterGeneratorIF
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<AttributeDefinition> |
allAttr |
protected boolean |
anyAttributes |
protected boolean |
anyMVAttributes |
protected boolean |
anyMVRefs |
protected boolean |
anySVAttributes |
protected StringBuffer |
attributeInfo |
protected String |
baseWrapperImport |
protected String |
dmwdir |
protected String |
extendedDir |
protected String |
fileHeader |
protected Boolean |
fullJavaEnvironment |
protected String |
genContext |
protected String |
gendir |
protected String |
genSuffix |
protected String |
hierarchicWrapperImport |
protected String |
namedWrapperImport |
protected PrintStream |
progress |
protected SchemaManager |
schema |
protected SchemaFormatter |
sformatter |
protected Boolean |
useWrappedObjectRefs |
| Constructor and Description |
|---|
BaseDMWGenerator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createCloneItMethod(BufferedWriter out,
DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd)
Derived classes should override this to provide a cloning mechanism if they need it.
|
protected void |
createExtendedWrapperClasses(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm)
If a class has wrapperType EXTENDED, we'll generate the extended class if it isn't already there.
|
protected void |
createIfRequired(String outdir)
Creates the specified directory is it doesn't already exist.
|
protected void |
createWrappers(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm) |
void |
dumpAdditionalWrapperDefinitions(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd,
BufferedWriter out)
At this level, we do nothing.
|
void |
dumpAdditionalWrapperFunctions(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd,
BufferedWriter out)
At this level, we do nothing.
|
protected void |
dumpAUX(ClassDefinition cd,
String outdir)
Dumps a file named
|
protected void |
dumpExtendedClass(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd)
At this level, we do nothing.
|
void |
gatherUserInput(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm)
In cases where your generator requires some further input from the user,
you can overload this method to perform that interaction.
|
void |
getAdditionalWrapperImports(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd,
ImportManager imports)
At this level, we do nothing.
|
void |
getAdditionalWrapperInterfaces(DmgConfigDMO config,
ConfigLocation loc,
ConfigFinder f,
SchemaManager sm,
ClassDefinition cd,
ImplementsManager implManager)
At this level, we do nothing.
|
void |
getAttributesAndImports(ClassDefinition cd,
ArrayList<AttributeDefinition> allAttr,
ImportManager imports)
This method cycles through the class derivation hierarchy and the types required by all
attributes associated with this class to determine the appropriate set of import statements
required for the DMO.
|
void |
setFileHeader(String fh)
In some cases, it's convenient to be able to dump a common header to your generated
files.
|
void |
setProgressStream(PrintStream ps)
If the overall generation process wants you to provide feedback, this method will be
called with a handle to the print stream where you should display progress messages.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgenerateCodeprotected String gendir
protected String dmwdir
protected String extendedDir
protected String fileHeader
protected ArrayList<AttributeDefinition> allAttr
protected PrintStream progress
protected SchemaManager schema
protected SchemaFormatter sformatter
protected StringBuffer attributeInfo
protected boolean anyMVAttributes
protected boolean anySVAttributes
protected boolean anyMVRefs
protected boolean anyAttributes
protected String genContext
protected String genSuffix
protected Boolean useWrappedObjectRefs
protected Boolean fullJavaEnvironment
protected String baseWrapperImport
protected String namedWrapperImport
protected String hierarchicWrapperImport
public void gatherUserInput(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm)
DarkMatterGeneratorIFgatherUserInput in interface DarkMatterGeneratorIFconfig - The generator config.loc - The location where the config was found. Code if often generated relative to
this location.f - The configuration findersm - The schema manager that contains the base schema plus any others that
were requested in the .dmg config file via the schemaToLoad attribute.public void setProgressStream(PrintStream ps)
DarkMatterGeneratorIFsetProgressStream in interface DarkMatterGeneratorIFps - The print streampublic void setFileHeader(String fh)
DarkMatterGeneratorIFsetFileHeader in interface DarkMatterGeneratorIFfh - The header text.protected void createExtendedWrapperClasses(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm) throws IOException, ResultException
IOExceptionResultExceptionprotected void dumpExtendedClass(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd) throws IOException
IOExceptionprotected void createWrappers(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm) throws IOException, ResultException
IOExceptionResultExceptionpublic void getAdditionalWrapperImports(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd, ImportManager imports) throws IOException
config - loc - f - sm - cd - imports - IOExceptionpublic void getAdditionalWrapperInterfaces(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd, ImplementsManager implManager) throws IOException
config - loc - f - sm - cd - imports - IOExceptionpublic void dumpAdditionalWrapperDefinitions(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd, BufferedWriter out) throws IOException
config - loc - f - sm - cd - out - IOExceptionpublic void dumpAdditionalWrapperFunctions(DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd, BufferedWriter out) throws IOException
config - loc - f - sm - cd - out - IOExceptionprotected void createCloneItMethod(BufferedWriter out, DmgConfigDMO config, ConfigLocation loc, ConfigFinder f, SchemaManager sm, ClassDefinition cd) throws IOException
config - loc - f - sm - cd - IOExceptionprotected void dumpAUX(ClassDefinition cd, String outdir) throws IOException
cd - The definition of the class.outdir - The output directory.IOExceptionpublic void getAttributesAndImports(ClassDefinition cd, ArrayList<AttributeDefinition> allAttr, ImportManager imports)
cd - The class definition of the object.allAttr - An array that will be populated with all attribute definitions of the class.imports - The import manager where we accumulate required imports.protected void createIfRequired(String outdir)
Copyright © 2023. All rights reserved.