|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exolab.castor.builder.SingleClassGenerator
public final class SingleClassGenerator
Writes a single class (and any associated inner classes) to a file.
Constructor Summary | |
---|---|
SingleClassGenerator(ConsoleDialog dialog,
SourceGenerator sourceGenerator,
java.lang.String conflictStrategyType,
java.lang.String jClassPrinterType)
Creates an instance of this class. |
Method Summary | |
---|---|
SourceGenerator |
getSourceGenerator()
Returns the SourceGenerator instance that created this class. |
(package private) boolean |
process(JClass[] classes,
SGStateInfo state)
Processes the given JClasses, one by one, stopping if the SourceGenerator state indicates STOP after processing one class. |
(package private) boolean |
process(JClass jClass,
SGStateInfo state)
Processes the given JClass by checking for class name conflicts, and if there are none, making the class as processed and then printing the class and, if appropriate, its class descriptors. |
(package private) boolean |
processIfNotAlreadyProcessed(java.util.Enumeration<?> classKeys,
SGStateInfo state)
Processes the JClass mapped by the provided key unless the JClass has already been processed. |
void |
setDescriptorCreation(boolean createDescriptors)
Sets whether or not to create ClassDescriptors for the generated classes. |
void |
setDestDir(java.lang.String destDir)
Sets the destination directory. |
void |
setJClassPrinterType(java.lang.String jclassPrinterType)
Sets the type of the JClassPrinter instance to be used for JClass writing. |
void |
setJdoDescriptorCreation(boolean createJdoDescriptors)
Sets whether or not to create JDOClassDescriptors for the generated classes. |
void |
setLineSeparator(java.lang.String lineSeparator)
Sets the line separator to use when printing the source code. |
void |
setNameConflictStrategy(java.lang.String nameConflictStrategy)
Sets the desired ClassNameCRStrategy instance type to be used
for name conflict resolution. |
void |
setPromptForOverwrite(boolean promptForOverwrite)
Sets whether or not to prompt when we would otherwise overwrite an existing JClass. |
void |
setResourceDestinationDirectory(java.lang.String destinationDirectory)
Sets the destination directory for generated resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SingleClassGenerator(ConsoleDialog dialog, SourceGenerator sourceGenerator, java.lang.String conflictStrategyType, java.lang.String jClassPrinterType)
dialog
- A ConsoleDialog instancesourceGenerator
- A SourceGenerator instanceconflictStrategyType
- Type of the ClassNameCRStrategy
instance to be used.jClassPrinterType
- The string representation of the printer to be used,Method Detail |
---|
public void setJClassPrinterType(java.lang.String jclassPrinterType)
JClassPrinter
instance to be used for JClass
writing.
jclassPrinterType
- The string identifier if the printer,public void setDestDir(java.lang.String destDir)
destDir
- the destination directory.public void setResourceDestinationDirectory(java.lang.String destinationDirectory)
destDir
- the destination directory.public void setLineSeparator(java.lang.String lineSeparator)
lineSeparator
- the line separator to use when printing the source code. This
method is useful if you are generating source on one platform,
but will be compiling the source on a different platform.
Note:This can be any string, so be careful. I
recommend either using the default or using one of the
following:
windows systems use: "\r\n" unix systems use: "\n" mac systems use: "\r"
public void setDescriptorCreation(boolean createDescriptors)
createDescriptors
- a boolean, when true indicates to generated ClassDescriptorspublic void setJdoDescriptorCreation(boolean createJdoDescriptors)
createJdoDescriptors
- if true, JDOClassDescriptors are generated.public void setPromptForOverwrite(boolean promptForOverwrite)
promptForOverwrite
- the new valueboolean processIfNotAlreadyProcessed(java.util.Enumeration<?> classKeys, SGStateInfo state) throws java.io.IOException
state
- SourceGenerator stateclassKeys
- Enumeration over a collection of keys to ClassInfos
java.io.IOException
- If an already existing '.castor.cdr' file can not be
loaded or foundboolean process(JClass[] classes, SGStateInfo state) throws java.io.IOException
classes
- Array of classes to processstate
- SourceGenerator state
java.io.IOException
- If an already existing '.castor.cdr' file can not be
loaded or foundboolean process(JClass jClass, SGStateInfo state) throws java.io.IOException
If there is a class name conflict, at best the user stops the source generation and at worst the user continues, skipping this class.
jClass
- the class to processstate
- SourceGenerator state
java.io.IOException
- If an already existing '.castor.cdr' file can not be
loaded or foundpublic void setNameConflictStrategy(java.lang.String nameConflictStrategy)
ClassNameCRStrategy
instance type to be used
for name conflict resolution.
nameConflictStrategy
- the desired ClassNameCRStrategy
instance typepublic SourceGenerator getSourceGenerator()
SourceGenerator
instance that created this class.
SourceGenerator
instance that created this class.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |