Public Member Functions | Static Public Member Functions | Static Package Attributes

org.exolab.castor.builder.SourceGenerator Class Reference

Inheritance diagram for org.exolab.castor.builder.SourceGenerator:
org.exolab.castor.builder.BuilderConfiguration

List of all members.

Public Member Functions

 SourceGenerator ()
 SourceGenerator (FieldInfoFactory infoFactory)
 SourceGenerator (FieldInfoFactory infoFactory, ExtendedBinding binding)
void generateSource (Schema schema, String packageName)
void generateSource (InputSource source, String packageName)
void generateSource (Reader reader, String packageName)
void generateSource (String filename, String packageName) throws java.io.FileNotFoundException
void setSAX1 (boolean sax1)
void setSuppressNonFatalWarnings (boolean suppress)
void setVerbose (boolean verbose)
void setDescriptorCreation (boolean createDescriptors)
void setDestDir (String destDir)
void setCreateMarshalMethods (boolean createMarshalMethods)
void setGenerateImportedSchemas (boolean generate)
void setTestable (boolean testable)
void setBinding (ExtendedBinding binding)
void setBinding (String fileName)
void setBinding (InputSource source)
void setLineSeparator (String lineSeparator)
boolean mappingSchemaElement2Java ()
boolean mappingSchemaType2Java ()

Static Public Member Functions

static String getVersion ()
static void main (String[] args)
static String toURIRepresentation (String path)

Static Package Attributes

static final String APP_NAME = "Castor"
static final String APP_DESC = "XML data binder for Java"
static final String VERSION = Version.VERSION
static final String APP_URI = "http://www.castor.org"

Detailed Description

A Java Source generation tool which uses XML Schema definitions to create an Object model.

Author:
Keith Visco - Main author.
Arnaud Blandin - Contributions.
Nathan Green - Contributions.
Version:
Revision:
1.16
Date:
2004/11/11 15:58:53

Constructor & Destructor Documentation

org.exolab.castor.builder.SourceGenerator.SourceGenerator (  ) 

Creates a SourceGenerator using the default FieldInfo factory

Referenced by org.exolab.castor.builder.SourceGenerator.main().

org.exolab.castor.builder.SourceGenerator.SourceGenerator ( FieldInfoFactory  infoFactory  ) 

Creates a SourceGenerator using the specific field info Factory.

Parameters:
infoFactory the FieldInfoFactory to use.
org.exolab.castor.builder.SourceGenerator.SourceGenerator ( FieldInfoFactory  infoFactory,
ExtendedBinding  binding 
)

Creates a SourceGenerator using the specific field info Factory and the given Binding element .

Parameters:
infoFactory the FieldInfoFactory to use.
binding the binding element to use.

References org.exolab.javasource.JComment.appendComment(), org.exolab.castor.builder.BuilderConfiguration.load(), and org.exolab.castor.builder.SourceGenerator.setBinding().


Member Function Documentation

void org.exolab.castor.builder.SourceGenerator.generateSource ( InputSource  source,
String  packageName 
)

Creates Java Source code (Object model) for the given XML Schema

Parameters:
source - the InputSource representing the XML schema.
packageName the package for the generated source files

References org.exolab.castor.builder.SourceGenerator.generateSource(), org.exolab.castor.util.Configuration.getParser(), org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.getSchema(), org.exolab.castor.builder.util.ConsoleDialog.notify(), and org.exolab.castor.core.exceptions.CastorException.printStackTrace().

void org.exolab.castor.builder.SourceGenerator.generateSource ( String  filename,
String  packageName 
) throws java.io.FileNotFoundException

Creates Java Source code (Object model) for the given XML Schema.

Parameters:
filename the full path to the XML Schema definition
packageName the package for the generated source files

References org.exolab.castor.builder.SourceGenerator.generateSource(), and org.exolab.castor.builder.SourceGenerator.toURIRepresentation().

void org.exolab.castor.builder.SourceGenerator.generateSource ( Reader  reader,
String  packageName 
)

Creates Java Source code (Object model) for the given XML Schema.

Parameters:
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 files

References org.exolab.castor.builder.SourceGenerator.generateSource().

static String org.exolab.castor.builder.SourceGenerator.getVersion (  )  [static]

Returns the version number of this SourceGenerator

Returns:
the version number of this SourceGenerator

References org.exolab.castor.builder.SourceGenerator.VERSION.

boolean org.exolab.castor.builder.SourceGenerator.mappingSchemaElement2Java (  ) 

Tests the org.exolab.castor.builder.javaclassmapping property for the 'element' value.

Returns:
True if the Source Generator is mapping schema elements to Java classes.

Reimplemented from org.exolab.castor.builder.BuilderConfiguration.

References org.exolab.castor.builder.binding.XMLBindingComponent.getBinding(), org.exolab.castor.builder.binding.Binding.getDefaultBindingType(), and org.exolab.castor.builder.binding.types.BindingType.getType().

boolean org.exolab.castor.builder.SourceGenerator.mappingSchemaType2Java (  ) 

Tests the org.exolab.castor.builder.javaclassmapping property for the 'type' value.

Returns:
True if the Source Generator is mapping schema types to Java classes.

Reimplemented from org.exolab.castor.builder.BuilderConfiguration.

References org.exolab.castor.builder.binding.XMLBindingComponent.getBinding(), org.exolab.castor.builder.binding.Binding.getDefaultBindingType(), and org.exolab.castor.builder.binding.types.BindingType.getType().

void org.exolab.castor.builder.SourceGenerator.setBinding ( InputSource  source  ) 

Sets the binding to use given an InputSource identifying a Castor Binding File.

Parameters:
source an InputSource identifying a Castor Binding File.

References org.exolab.castor.builder.binding.BindingException.getMessage(), org.exolab.castor.builder.util.ConsoleDialog.notify(), and org.exolab.castor.builder.SourceGenerator.setBinding().

void org.exolab.castor.builder.SourceGenerator.setBinding ( ExtendedBinding  binding  ) 
void org.exolab.castor.builder.SourceGenerator.setBinding ( String  fileName  ) 

Sets the binding to use given the path name of a Castor Binding File.

Parameters:
fileName the file that represents a Binding

References org.exolab.castor.builder.binding.BindingException.getMessage(), org.exolab.castor.builder.util.ConsoleDialog.notify(), and org.exolab.castor.builder.SourceGenerator.setBinding().

void org.exolab.castor.builder.SourceGenerator.setCreateMarshalMethods ( boolean  createMarshalMethods  ) 

Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes. By default, these methods are generated.

Parameters:
createMarshalMethods a boolean, when true indicates to generated the marshalling framework methods

References org.exolab.castor.builder.SourceFactory.setCreateMarshalMethods().

Referenced by org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

void org.exolab.castor.builder.SourceGenerator.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

Referenced by org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

void org.exolab.castor.builder.SourceGenerator.setDestDir ( String  destDir  ) 

Sets the destination directory.

Parameters:
destDir the destination directory.

Referenced by org.exolab.castor.tools.XSDCompiler.execute(), org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

void org.exolab.castor.builder.SourceGenerator.setGenerateImportedSchemas ( boolean  generate  ) 

Sets whether or not to generate Java sources for imported XML Schema. By default Java sources for imported XML schemas are not generated.

Parameters:
generate true to generate the java classes for the imported XML Schema

Referenced by org.exolab.castor.builder.SourceGenerator.main().

void org.exolab.castor.builder.SourceGenerator.setLineSeparator ( String  lineSeparator  ) 

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"
 

Referenced by org.exolab.castor.tools.XSDCompiler.execute(), org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

void org.exolab.castor.builder.SourceGenerator.setSAX1 ( boolean  sax1  ) 

Set to true if SAX1 should be used in the marshall method

References org.exolab.castor.builder.SourceFactory.setSAX1().

Referenced by org.exolab.castor.builder.SourceGenerator.main().

void org.exolab.castor.builder.SourceGenerator.setSuppressNonFatalWarnings ( boolean  suppress  ) 
void org.exolab.castor.builder.SourceGenerator.setTestable ( boolean  testable  ) 

Sets whether or not to create the XML marshalling framework specific methods (marshall, unmarshall, validate) in the generated classes. By default, these methods are generated.

Parameters:
createMarshall a boolean, when true indicates to generated the marshalling framework methods

References org.exolab.castor.builder.SourceFactory.setTestable().

Referenced by org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

void org.exolab.castor.builder.SourceGenerator.setVerbose ( boolean  verbose  ) 

Sets whether or not the source code generator prints additional messages during generating source code

Parameters:
verbose a boolean, when true indicates to print additional messages

Referenced by org.exolab.castor.builder.SourceGenerator.main(), and alma.tools.entitybuilder.CastorBuilder.run().

static String org.exolab.castor.builder.SourceGenerator.toURIRepresentation ( String  path  )  [static]

Returns a string which is the URI of a file.

No validation is done to check wether the file exists or not. This method will be no longer used when the JDK URL.toString() is fixed.

Parameters:
path the absolute path of the file.
Returns:
a string representing the URI of the file

Referenced by org.exolab.castor.builder.SourceGenerator.generateSource().


Member Data Documentation

final String org.exolab.castor.builder.SourceGenerator.APP_DESC = "XML data binder for Java" [static, package]

The application description

final String org.exolab.castor.builder.SourceGenerator.APP_NAME = "Castor" [static, package]

The application name

Referenced by org.exolab.castor.builder.SourceGenerator.main().

final String org.exolab.castor.builder.SourceGenerator.APP_URI = "http://www.castor.org" [static, package]

The application URI


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties