public class SourceGenerator extends BuilderConfiguration
BuilderConfiguration.Property
Modifier and Type | Field | Description |
---|---|---|
protected SGStateInfo |
_sInfo |
|
(package private) static java.lang.String |
APP_DESC |
The application description.
|
(package private) static java.lang.String |
APP_NAME |
The application name.
|
(package private) static java.lang.String |
APP_URI |
The application URI.
|
(package private) static java.lang.String |
VERSION |
The application version.
|
Constructor | Description |
---|---|
SourceGenerator() |
Creates a SourceGenerator using the default FieldInfo factory.
|
SourceGenerator(FieldInfoFactory infoFactory) |
Creates a SourceGenerator using the specific field info Factory.
|
SourceGenerator(FieldInfoFactory infoFactory,
ExtendedBinding binding) |
Creates a SourceGenerator using the specific field info Factory and the
given Binding element.
|
Modifier and Type | Method | Description |
---|---|---|
void |
generateSource(java.io.Reader reader,
java.lang.String packageName) |
Creates Java Source code (Object model) for the given XML Schema.
|
void |
generateSource(java.lang.String filename,
java.lang.String packageName) |
Creates Java Source code (Object model) for the given XML Schema.
|
void |
generateSource(Schema schema,
java.lang.String packageName) |
Creates Java Source code (Object model) for the given XML Schema.
|
void |
generateSource(org.xml.sax.InputSource source,
java.lang.String packageName) |
Creates Java Source code (Object model) for the given XML Schema.
|
boolean |
getGenerateImportedSchemas() |
Indicates whether classes should be created for imported XML schemas as well.
|
JClassPrinterFactoryRegistry |
getJClassPrinterFactoryRegistry() |
Returns the registry for
JClassPrinterFactory instances. |
static java.lang.String |
getVersion() |
Returns the version number of this SourceGenerator.
|
JClassRegistry |
getXMLInfoRegistry() |
Returns the
JClassRegistry instance associated with this source generator. |
static void |
main(java.lang.String[] args) |
Deprecated.
Please use
SourceGeneratorMain.main(String[]) |
boolean |
mappingSchemaElement2Java() |
Tests the org.exolab.castor.builder.javaclassmapping property for the
'element' value.
|
boolean |
mappingSchemaType2Java() |
Tests the org.exolab.castor.builder.javaclassmapping property for the
'type' value.
|
void |
setBinding(java.lang.String fileName) |
Sets the binding to use given the path name of a Castor Binding File.
|
void |
setBinding(ExtendedBinding binding) |
Sets the binding to use with this instance of the SourceGenerator.
|
void |
setBinding(org.xml.sax.InputSource source) |
Sets the binding to use given an InputSource identifying
a Castor Binding File.
|
void |
setCaseInsensitive(boolean caseInsensitive) |
Set to true if enumerated type lookups should be performed in a case
insensitive manner.
|
void |
setClassNameConflictResolver(java.lang.String resolverName) |
Sets the ClassNameConflictResolver instance to be used for automatic class name
conflict resolution.
|
void |
setCreateMarshalMethods(boolean createMarshalMethods) |
Sets whether or not to create the XML marshaling framework specific
methods (marshal, unmarshal, validate) in the generated classes.
|
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 |
setFailOnFirstError(boolean failOnFirstError) |
If true, the source generator will fail on the first error encountered.
|
void |
setGenerateImportedSchemas(boolean generate) |
Sets whether or not to generate Java sources for imported XML Schema.
|
void |
setGenerateMappingFile(boolean generateMapping) |
Sets whether or not a mapping file should be generated, this is false by
default.
|
void |
setJClassPrinterType(java.lang.String jClassPrinterType) |
Sets the jclassPrinter type.
|
void |
setJdoDescriptorCreation(boolean createJdoDescriptors) |
Sets whether or not to create JDO-specific class descriptors for the
generated classes.
|
void |
setLineSeparator(java.lang.String lineSeparator) |
Sets the line separator to use when printing the source code.
|
void |
setMappingFilename(java.lang.String filename) |
Sets the filename of the mapping file.
|
void |
setNameConflictStrategy(java.lang.String nameConflictStrategy) |
Sets the strategy for handling name conflicts.
|
void |
setResourceDestination(java.lang.String destination) |
Sets the destination directory for resources, e.g.
|
void |
setSAX1(boolean sax1) |
Set to true if SAX1 should be used in the marshal method.
|
void |
setSuppressNonFatalWarnings(boolean suppress) |
Sets whether or not to suppress non-fatal warnings encountered during
source generation.
|
void |
setTestable(boolean testable) |
Sets whether or not to implement CastorTestable.
|
void |
setVerbose(boolean verbose) |
Sets whether or not the source code generator prints additional messages
during generating source code.
|
static java.lang.String |
toURIRepresentation(java.lang.String path) |
Returns a string which is the URI of a file.
|
addAnnotationBuilder, boundPropertiesEnabled, classDescFieldNames, equalsMethod, forceUseJava50, generateExtraCollectionMethods, generateExtraDocumentationMethods, getAnnotationBuilders, getAutomaticConflictResolutionTypeSuffix, getDefault, getJavaNaming, getJClassPrinterFactories, getMaximumNumberOfConstants, getProperty, isAutomaticConflictResolution, load, loadProperties, lookupPackageByLocation, lookupPackageByNamespace, processNamespacePackageMappings, setClassDescFieldNames, setDefaultProperties, setEqualsMethod, setJavaNaming, setLocationPackageMapping, setNamespacePackageMapping, setPrimitiveWrapper, setUseEnumeratedTypeInterface, useCycleBreaker, useEnumeratedTypeInterface, useJava50, useJava5Enums, usePrimitiveWrapper
static final java.lang.String APP_NAME
static final java.lang.String APP_DESC
static final java.lang.String VERSION
static final java.lang.String APP_URI
protected SGStateInfo _sInfo
public SourceGenerator()
public SourceGenerator(FieldInfoFactory infoFactory)
infoFactory
- the FieldInfoFactory to use.public SourceGenerator(FieldInfoFactory infoFactory, ExtendedBinding binding)
infoFactory
- the FieldInfoFactory to use.binding
- the binding element to use.public final void setMappingFilename(java.lang.String filename)
filename
- filename of the mapping filepublic final void setNameConflictStrategy(java.lang.String nameConflictStrategy)
nameConflictStrategy
- the name of the stretegy to use for handling
name conflicts.public static java.lang.String getVersion()
public final void setSAX1(boolean sax1)
sax1
- true if SAX1 should be used in the marshal methodpublic final void setCaseInsensitive(boolean caseInsensitive)
caseInsensitive
- when true, enumerated type lookups will be
performed in a case insensitive manner.public final void setFailOnFirstError(boolean failOnFirstError)
failOnFirstError
- if true, the source generator will fail on the
first error encountered.public final void setSuppressNonFatalWarnings(boolean suppress)
suppress
- true if non-fatal warnings should be suppressed.public void setVerbose(boolean verbose)
verbose
- a boolean, when true indicates to print additional
messagespublic void setClassNameConflictResolver(java.lang.String resolverName)
resolverName
- The name of the resolver to be used for automatic class name
conflict resolutionpublic final void setDescriptorCreation(boolean createDescriptors)
createDescriptors
- a boolean, when true indicates to generated
ClassDescriptorspublic final void setJdoDescriptorCreation(boolean createJdoDescriptors)
createJdoDescriptors
- a boolean, when true indicates to generated
JDO-specific class descriptorspublic final void setDestDir(java.lang.String destDir)
destDir
- the destination directory.public final void setResourceDestination(java.lang.String destination)
destDir
- the destination directory for resources.public final void setCreateMarshalMethods(boolean createMarshalMethods)
createMarshalMethods
- a boolean, when true indicates to generated
the marshaling framework methodspublic final void setGenerateImportedSchemas(boolean generate)
generate
- true to generate the java classes for the imported XML Schemapublic final void setGenerateMappingFile(boolean generateMapping)
generateMapping
- a flag that indicates whether or not a mapping
file should be generated.public final void setTestable(boolean testable)
testable
- a boolean, when true indicates to implement CastorTestablepublic final void setBinding(ExtendedBinding binding)
binding
- the binding to use, null indicates that the default binding
will be used.public final void setBinding(java.lang.String fileName)
fileName
- the file that represents a Bindingpublic final void setBinding(org.xml.sax.InputSource source)
source
- an InputSource identifying a Castor Binding File.public final void setLineSeparator(java.lang.String lineSeparator)
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"
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.public final boolean mappingSchemaElement2Java()
mappingSchemaElement2Java
in class BuilderConfiguration
public final boolean mappingSchemaType2Java()
mappingSchemaType2Java
in class BuilderConfiguration
public final void generateSource(java.lang.String filename, java.lang.String packageName) throws java.io.IOException
generateSource(InputSource, String)
.filename
- the full path to the XML Schema definitionpackageName
- the package for the generated source filesjava.io.IOException
- if an IOException occurs writing the new source filespublic final void generateSource(java.io.Reader reader, java.lang.String packageName) throws java.io.IOException
generateSource(InputSource, String)
.reader
- the Reader with which to read the XML Schema definition.
The caller should close the reader, since thie method will not do
so.packageName
- the package for the generated source filesjava.io.IOException
- if an IOException occurs writing the new source filespublic void generateSource(org.xml.sax.InputSource source, java.lang.String packageName) throws java.io.IOException
generateSource(Schema, String)
to actually generate the source.source
- - the InputSource representing the XML schema.packageName
- the package for the generated source filesjava.io.IOException
- if an IOException occurs writing the new source filespublic final void generateSource(Schema schema, java.lang.String packageName) throws java.io.IOException
Schema
already parsed.schema
- the XML schema to generate the Java sources for.packageName
- the package for the generated source files.java.io.IOException
- if this Exception occurs while generating sourceto provide the schema filename
,
to provide a Reader for the schema
,
to provide an InputSource for
the schema
public static java.lang.String toURIRepresentation(java.lang.String path)
path
- The absolute path of the file.public static void main(java.lang.String[] args)
SourceGeneratorMain.main(String[])
args
- our command line arguments.public JClassRegistry getXMLInfoRegistry()
JClassRegistry
instance associated with this source generator.JClassRegistry
instance currently in use.public final void setJClassPrinterType(java.lang.String jClassPrinterType)
jClassPrinterType
- The string identifier of the printer to use.public boolean getGenerateImportedSchemas()
public JClassPrinterFactoryRegistry getJClassPrinterFactoryRegistry()
JClassPrinterFactory
instances.JClassPrinterFactory
instances.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com