public class SourceGenerator extends BuilderConfiguration
BuilderConfiguration.Property| Modifier and Type | Field and Description |
|---|---|
(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 and 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 and Description |
|---|---|
void |
generateSource(org.xml.sax.InputSource source,
java.lang.String packageName)
Creates Java Source code (Object model) for the given XML Schema.
|
void |
generateSource(java.io.Reader reader,
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(java.lang.String filename,
java.lang.String packageName)
Creates Java Source code (Object model) for the given XML Schema.
|
static java.lang.String |
getVersion()
Returns the version number of this SourceGenerator
|
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(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 |
setBinding(java.lang.String fileName)
Sets the binding to use given the path name of a Castor Binding File.
|
void |
setCaseInsensitive(boolean caseInsensitive)
Set to true if enumerated type lookups should be performed in a case
insensitive manner.
|
void |
setCreateMarshalMethods(boolean createMarshalMethods)
Sets whether or not to create the XML marshalling framework specific
methods (marshall, unmarshall, 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 |
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 |
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.
|
boundPropertiesEnabled, classDescFieldNames, equalsMethod, generateExtraCollectionMethods, getDefault, getProperty, load, lookupPackageByLocation, lookupPackageByNamespace, processNamespacePackageMappings, setClassDescFieldNames, setDefaultProperties, setEqualsMethod, setLocationPackageMapping, setNamespacePackageMapping, setPrimitiveWrapper, setUseEnumeratedTypeInterface, useEnumeratedTypeInterface, useJava50, usePrimitiveWrapperstatic 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
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 void setMappingFilename(java.lang.String filename)
filename - filename of the mapping filepublic static java.lang.String getVersion()
public void setSAX1(boolean sax1)
sax1 - true if SAX1 should be used in the marshal methodpublic void setCaseInsensitive(boolean caseInsensitive)
caseInsensitive - when true, enumerated type lookups will be
performed in a case insensitive manner.public void setFailOnFirstError(boolean failOnFirstError)
failOnFirstError - if true, the source generator will fail on the first error
encountered.public 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 setDescriptorCreation(boolean createDescriptors)
createDescriptors - a boolean, when true indicates to generated ClassDescriptorspublic void setDestDir(java.lang.String destDir)
destDir - the destination directory.public void setCreateMarshalMethods(boolean createMarshalMethods)
createMarshalMethods - a boolean, when true indicates
to generated the marshalling framework methodspublic void setGenerateImportedSchemas(boolean generate)
generate - true to generate the java classes for the imported XML Schemapublic void setGenerateMappingFile(boolean generateMapping)
generateMapping - a flag that indicates whether or not a mapping file should be
generated.public void setTestable(boolean testable)
testable - a boolean, when true indicates to implement CastorTestablepublic void setBinding(ExtendedBinding binding)
binding - the binding to use, null indicates that the default binding
will be used.public void setBinding(java.lang.String fileName)
fileName - the file that represents a Bindingpublic void setBinding(org.xml.sax.InputSource source)
source - an InputSource identifying a Castor Binding File.public 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 boolean mappingSchemaElement2Java()
mappingSchemaElement2Java in class BuilderConfigurationpublic boolean mappingSchemaType2Java()
mappingSchemaType2Java in class BuilderConfigurationpublic 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 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 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 schemapublic 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.Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com