Class SingleClassGenerator
java.lang.Object
org.exolab.castor.builder.SingleClassGenerator
Writes a single class (and any associated inner classes) to a file.
- Version:
- $Revision: 0000 $ $Date: $
- Author:
- Keith Visco - Main author., Arnaud Blandin - Contributions., Nathan Green - Contributions., Edward Kuns - Separated from SourceGenerator
-
Constructor Summary
ConstructorsConstructorDescriptionSingleClassGenerator(ConsoleDialog dialog, SourceGenerator sourceGenerator, String conflictStrategyType, String jClassPrinterType) Creates an instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionReturns theSourceGeneratorinstance that created this class.voidsetDescriptorCreation(boolean createDescriptors) Sets whether or not to create ClassDescriptors for the generated classes.voidsetDestDir(String destDir) Sets the destination directory.voidsetJClassPrinterType(String jclassPrinterType) Sets the type of theJClassPrinterinstance to be used forJClasswriting.voidsetJdoDescriptorCreation(boolean createJdoDescriptors) Sets whether or not to create JDOClassDescriptors for the generated classes.voidsetLineSeparator(String lineSeparator) Sets the line separator to use when printing the source code.voidsetNameConflictStrategy(String nameConflictStrategy) Sets the desiredClassNameCRStrategyinstance type to be used for name conflict resolution.voidsetPromptForOverwrite(boolean promptForOverwrite) Sets whether or not to prompt when we would otherwise overwrite an existing JClass.voidsetResourceDestinationDirectory(String destinationDirectory) Sets the destination directory for generated resources.
-
Constructor Details
-
SingleClassGenerator
public SingleClassGenerator(ConsoleDialog dialog, SourceGenerator sourceGenerator, String conflictStrategyType, String jClassPrinterType) Creates an instance of this class.- Parameters:
dialog- A ConsoleDialog instancesourceGenerator- A SourceGenerator instanceconflictStrategyType- Type of theClassNameCRStrategyinstance to be used.jClassPrinterType- The string representation of the printer to be used,
-
-
Method Details
-
setJClassPrinterType
Sets the type of theJClassPrinterinstance to be used forJClasswriting.- Parameters:
jclassPrinterType- The string identifier if the printer,
-
setDestDir
Sets the destination directory.- Parameters:
destDir- the destination directory.
-
setResourceDestinationDirectory
Sets the destination directory for generated resources.- Parameters:
destDir- the destination directory.
-
setLineSeparator
Sets the line separator to use when printing the source code.- Parameters:
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"
-
setDescriptorCreation
public void setDescriptorCreation(boolean createDescriptors) Sets whether or not to create ClassDescriptors for the generated classes. By default, descriptors are generated.- Parameters:
createDescriptors- a boolean, when true indicates to generated ClassDescriptors
-
setJdoDescriptorCreation
public void setJdoDescriptorCreation(boolean createJdoDescriptors) Sets whether or not to create JDOClassDescriptors for the generated classes. By default, descriptors are generated.- Parameters:
createJdoDescriptors- if true, JDOClassDescriptors are generated.
-
setPromptForOverwrite
public void setPromptForOverwrite(boolean promptForOverwrite) Sets whether or not to prompt when we would otherwise overwrite an existing JClass. If set to false, then it is always OK to overwrite an existing class. If set to true, the user will be prompted.- Parameters:
promptForOverwrite- the new value
-
setNameConflictStrategy
Sets the desiredClassNameCRStrategyinstance type to be used for name conflict resolution.- Parameters:
nameConflictStrategy- the desiredClassNameCRStrategyinstance type
-
getSourceGenerator
Returns theSourceGeneratorinstance that created this class.- Returns:
- the
SourceGeneratorinstance that created this class.
-