org.enhydra.zeus.util
Interface SourceGenerator

All Known Implementing Classes:
DTDSourceGenerator, XSDSourceGenerator

public interface SourceGenerator

This is a standalone "utility" interface. It allows source code generation from a set of XML constraints. It also allows for providing a standard set of methods that all utility source code generation classes should provide (at a minimum).

Author:
Brett McLaughlin

Method Summary
 void generate()
           This method performs class generation.
 void setCollapseSimpleElements(boolean collapseSimpleElements)
           This sets whether or not to collapse simple elements.
 void setCollapseSimpleElements(boolean collapseSimpleElements, boolean ignoreIDAttributes)
           This sets whether or not to collapse simple elements.
 void setConstraintsInput(java.io.File file)
           This allows for supplying the constraints file to use for source code generation as a File.
 void setConstraintsInput(java.io.InputStream inputStream)
           This allows for supplying the constraints file to use for source code generation as an InputStream.
 void setConstraintsInput(java.io.Reader reader)
           This allows for supplying the constraints file to use for source code generation as a FileReader.
 void setConstraintsInput(java.lang.String fileURI)
           This allows for supplying the constraints file to use for source code generation as a String URI.
 void setJavaPackage(java.lang.String javaPackage)
           This will set the package for generating classes within.
 void setOutputDir(java.io.File outputDir)
           This allows specification of an output directory for the generated classes.
 void setOutputDir(java.lang.String outputDir)
           This allows specification of an output directory for the generated classes.
 

Method Detail

setConstraintsInput

public void setConstraintsInput(java.lang.String fileURI)
                         throws java.io.IOException

This allows for supplying the constraints file to use for source code generation as a String URI.

Parameters:
fileURI - String URI for constraints file.
Throws:
IOException - - when the specified file URI is invalid.

setConstraintsInput

public void setConstraintsInput(java.io.File file)
                         throws java.io.IOException

This allows for supplying the constraints file to use for source code generation as a File.

Parameters:
file - File to read constraints from.
Throws:
IOException - - when the specified file URI is invalid.

setConstraintsInput

public void setConstraintsInput(java.io.Reader reader)

This allows for supplying the constraints file to use for source code generation as a FileReader.

Parameters:
reader - Reader to read constraints from.

setConstraintsInput

public void setConstraintsInput(java.io.InputStream inputStream)

This allows for supplying the constraints file to use for source code generation as an InputStream.

Parameters:
inputStream - InputStream to read constraints from.

setOutputDir

public void setOutputDir(java.lang.String outputDir)
                  throws java.io.IOException

This allows specification of an output directory for the generated classes.

Parameters:
outputDir - String specifying output directory for generated classes.

setOutputDir

public void setOutputDir(java.io.File outputDir)
                  throws java.io.IOException

This allows specification of an output directory for the generated classes.

Parameters:
outputDir - File specifying output directory for generated classes.

setJavaPackage

public void setJavaPackage(java.lang.String javaPackage)

This will set the package for generating classes within.

Parameters:
javaPackage - the package to generate classes within.

setCollapseSimpleElements

public void setCollapseSimpleElements(boolean collapseSimpleElements)

This sets whether or not to collapse simple elements. By default, simple elements are not collapsed. By default, ID attributes are not ignored in this determination.

Parameters:
collapseSimpleElements - whether or not to collapse simple elements.

setCollapseSimpleElements

public void setCollapseSimpleElements(boolean collapseSimpleElements,
                                      boolean ignoreIDAttributes)

This sets whether or not to collapse simple elements. By default, simple elements are not collapsed. It also allows specification of whether ID attributes should be ignored when making a determination if an element is simple.

Parameters:
collapseSimpleElements - whether or not to collapse simple elements.
ignoreIDAttributes - whether or not to ignore ID attributes.

generate

public void generate()
              throws java.io.IOException,
                     ZeusException

This method performs class generation.

Throws:
IOException - - when class generation fails
ZeusException - - when class generation fails.


Copyright © 2002 Enhydra. All Rights Reserved.