|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.zeus.util.BaseSourceGenerator
This provides basic functionality for classes that need to
implement the
interface.
SourceGenerator
Field Summary | |
protected boolean |
collapseSimpleElements
Whether or not to collapse simple elements |
protected java.io.Reader |
constraintsReader
The reader for reading constraints from |
protected boolean |
ignoreIDAttributes
Whether or not to ignore ID attributes |
protected java.lang.String |
javaPackage
The package to generate classes within |
protected java.io.File |
outputDir
The directory to output classes to |
Constructor Summary | |
BaseSourceGenerator()
This sets up defaults for the generator. |
Method Summary | |
void |
generate()
This method performs class generation. |
protected abstract java.util.List |
getConstraintBindings()
This defines a contract for subclasses to allow them to get the Zeus objects to generate code
from. |
protected Generator |
getGenerator()
This handles the process of creating a
for use in data binding. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.Reader constraintsReader
protected java.io.File outputDir
protected java.lang.String javaPackage
protected boolean collapseSimpleElements
protected boolean ignoreIDAttributes
Constructor Detail |
public BaseSourceGenerator()
This sets up defaults for the generator.
Method Detail |
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.
fileURI
- String
URI for constraints file.IOException
- - when the specified file URI
is invalid.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
.
file
- File
to read constraints from.IOException
- - when the specified file URI
is invalid.public void setConstraintsInput(java.io.Reader reader)
This allows for supplying the constraints file to use
for source code generation as a FileReader
.
reader
- Reader
to read constraints
from.public void setConstraintsInput(java.io.InputStream inputStream)
This allows for supplying the constraints file to use
for source code generation as an
InputStream
.
inputStream
- InputStream
to read
constraints from.public void setOutputDir(java.lang.String outputDir) throws java.io.IOException
This allows specification of an output directory for the generated classes.
outputDirString
- String
specifying output
directory for generated classes.IOException
- - when invalid direcotory is
specifiedpublic void setOutputDir(java.io.File outputDir) throws java.io.IOException
This allows specification of an output directory for the generated classes.
outputDir
- File
specifying output directory
for generated classes.IOException
- - when invalid direcotory is
specifiedpublic void setJavaPackage(java.lang.String javaPackage)
This will set the package for generating classes within.
javaPackage
- the package to generate classes within.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.
collapseSimpleElements
- whether or not to collapse simple
elements.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.
collapseSimpleElements
- whether or not to collapse simple
elements.ignoreIDAttributes
- whether or not to ignore ID attributes.public void generate() throws java.io.IOException, ZeusException
This method performs class generation.
IOException
- - when class generation failsZeusException
- - when class generation fails.protected abstract java.util.List getConstraintBindings() throws java.io.IOException
This defines a contract for subclasses to allow them to get the
Zeus
objects to generate code
from.
Binding
List
- a list of the Binding
objects to generate code from.IOException
- - when binding creation failsprotected Generator getGenerator()
This handles the process of creating a
for use in data binding.
Generator
This version returns a basic
, but other SimpleGenerator
Generator
implementations can be used by overriding this method.
Generator
- the Generator
to use.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |