A class for maintaining state for the SourceGenerator.
bindSourceCode
public void bindSourceCode(Annotated annotated,
JClass[] classes)
Binds the given Annotated structure with its generated source classes.
annotated
- the Annotated structure to add JClass bindings forclasses
- the JClass[] to bind
getCDRFile
public Properties getCDRFile(String filename)
Returns the CDRFile (Properties file) associated with the given filename.
filename
- filename of the CDR file to be processed
getCDRFilenames
public Enumeration getCDRFilenames()
Returns the set of CDR file names.
- the set of CDR file names.
getCurrentFactoryState
public FactoryState getCurrentFactoryState()
Returns the current FactoryState that holds information about the classes
being generated.
getDialog
public Dialog getDialog()
Returns the Dialog used for interacting with the user.
- the Dialog, or null if none has been set.
getImportedSourceCode
public JClass getImportedSourceCode(String className)
Returns the JClass with the given name or null if no bindings have been
specified for a JClass with the name. This method consults with JClass
instances imported through a Schema import only.
className
- the name of the JClass
- the (imported) JClass if found
getImportedSourcesByName
public Map getImportedSourcesByName()
Returns the sources as generated through XML schema imports.
- the sources as generated through XML schema imports.
getMapping
public MappingRoot getMapping(String filename)
Returns the Mapping file associated with the given filename.
filename
- The filename to search for a Mapping File association
getMappingFilenames
public Enumeration getMappingFilenames()
Returns the set of mapping filenames.
- the set of mapping filenames.
getPackageName
public String getPackageName()
Get package used when creating new classes.
- Package used when creating new classes.
getProcessed
(package private) JClass getProcessed(String className)
Returns the processed JClass with the given name. If no such JClass has
been marked as processed, null is returned.
className
- the JClass name to check against
- the JClass with the given name
getSchema
(package private) Schema getSchema()
Returns a reference to the schema for which we are generating source.
- a reference to the schema for which we are generating source.
getSourceCode
public JClass getSourceCode(String className)
Returns the JClass with the given name or null if no bindings have been
specified for a JClass with the name.
className
- the name of the JClass
getSourceCode
public JClass[] getSourceCode(Annotated annotated)
Returns the array of JClass for the given Annotated structure or null if
no bindings have been specified for the given Structure.
annotated
- the Annotated structure to search
getSourceGenerator
public SourceGenerator getSourceGenerator()
Returns the SourceGenerator instance being used.
- the SourceGenerator instance being used.
getSourcesByName
public Map getSourcesByName()
Returns the sources as generated through XML schema imports.
- the sources as generated through XML schema imports.
getStatusCode
public int getStatusCode()
Returns the current status.
getSuppressNonFatalWarnings
public boolean getSuppressNonFatalWarnings()
Returns true if non-fatal warnings should be suppressed.
- true if non-fatal warnings should be suppressed.
markAsProcessed
(package private) void markAsProcessed(JClass jClass)
Marks the given JClass as having been processed.
jClass
- the JClass to mark as having been processed.
processed
(package private) boolean processed(String className)
Returns true if a JClass with the given name has been marked as
processed.
className
- the JClass name to check against
- true if a JClass with the given name has been marked as processed
processed
(package private) boolean processed(JClass jClass)
Returns true if the given JClass has been marked as processed.
jClass
- the JClass to check for being marked as processed
- true if the given JClass has been marked as processed.
promptForOverwrite
(package private) boolean promptForOverwrite()
Returns true if existing source files should be prompted before being
overwritten.
- true if existing source files should be prompted before being
overwritten
setCDRFile
public void setCDRFile(String filename,
Properties props)
Sets the CDR (ClassDescriptorResolver) file associated with the given
filename.
filename
- the filename associated with the CDR fileprops
- the Properties file
setCurrentFactoryState
public void setCurrentFactoryState(FactoryState state)
Sets the current FactoryState.
state
- the current FactoryState
setDialog
(package private) void setDialog(Dialog dialog)
Sets the Dialog used for interacting with the user.
dialog
- the Dialog to use
setMapping
public void setMapping(String filename,
MappingRoot mapping)
Sets the Mapping file associated with the given filename.
filename
- the filename associated with the Mappingmapping
- the MappingRoot
setPackageName
protected void setPackageName(String packageName)
Set package used when creating new classes.
packageName
- Package used when creating new classes.
setPromptForOverwrite
(package private) void setPromptForOverwrite(boolean promptForOverwrite)
Sets whether or not existing source files should be silently overwritten
or whether the user should be prompted first.
promptForOverwrite
- true if existing files should not be silently
overwritten.
setStatusCode
public void setStatusCode(int status)
Sets the current status code to the given one.
status
- the new status code
setSuppressNonFatalWarnings
(package private) void setSuppressNonFatalWarnings(boolean suppressNonFatalWarnings)
Sets whether non-fatal warnings should be supporessed.
suppressNonFatalWarnings
- true if non-fatal warnings should be supporessed
setVerbose
(package private) void setVerbose(boolean verbose)
Sets whether or not the source code generator prints additional messages
during generating source code.
verbose
- a boolean, when true indicates to print additional
messages
storeImportedSourcesByName
public void storeImportedSourcesByName(Map importedSourcesByName)
Stores generated sources as processed within an imported schema.
importedSourcesByName
- Generated sources as processed within an imported schema.
verbose
public boolean verbose()
Returns the value of the verbose flag. A true value indicates that
additional messages may be printed during processing.
- the value of the verbose flag.