|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.maven.xmlcodegen.AbstractGenerator
public abstract class AbstractGenerator
Abstract base class for code generators.
Constructor Summary | |
---|---|
AbstractGenerator()
|
Method Summary | |
---|---|
protected void |
copy(java.io.File file,
java.lang.String baseLocation)
Copies a file to the output location. |
protected java.lang.String |
execute(java.lang.String templateName,
java.lang.Object input)
Executes a code generation template. |
protected java.io.File |
findSchemaFile(java.lang.String path)
Attempts to locate a schema file by name by iterating through schemaLookupDirectories . |
java.lang.String |
getPackageBase()
|
protected boolean |
included(org.eclipse.xsd.XSDNamedComponent c)
|
protected java.io.File |
outputLocation(java.lang.String baseLocation)
Convenience method for generating the output location of generated files based on #getLocation() |
void |
setIncluded(java.util.Set included)
|
void |
setOverwriting(boolean overwriting)
Flag controlling the behaviour of the generator when a generated file already exists. |
void |
setPackageBase(java.lang.String packageBase)
Sets the base package for generated classes. |
void |
setResourceLocation(java.lang.String resourceLocation)
Sets the location to write out generated resource files. |
void |
setSchemaLookupDirectories(java.io.File[] schemaLookupDirectories)
Sets the directories to use when attempting to locate a schema via a relative reference. |
void |
setSchemaSourceDirectory(java.io.File schemaSourceDirectory)
Sets the single directory to lookup schemas. |
void |
setSourceLocation(java.lang.String sourceLocation)
Sets the location to write out generated source files. |
void |
setTestLocation(java.lang.String testLocation)
Sets the location to write out generated test files. |
protected void |
write(java.lang.String result,
java.lang.String className,
java.lang.String baseLocation)
Writes out a string to a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractGenerator()
Method Detail |
---|
public void setPackageBase(java.lang.String packageBase)
packageBase
- Dot seperate package name, or null
for
no package.public java.lang.String getPackageBase()
public void setSourceLocation(java.lang.String sourceLocation)
location
- A file path.public void setTestLocation(java.lang.String testLocation)
testLocation
- A file path.public void setResourceLocation(java.lang.String resourceLocation)
resourceLocation
- A file path.public void setOverwriting(boolean overwriting)
If set to true
, the generator will overwrite existing files.
if set to false
, the generator will not overwrite the file
and issue a warning.
overwriting
- overwrite flag.public void setSchemaSourceDirectory(java.io.File schemaSourceDirectory)
schemaSourceDirectory
- A directory.public void setSchemaLookupDirectories(java.io.File[] schemaLookupDirectories)
schemaLookupDirectories
- An array of directories.protected void write(java.lang.String result, java.lang.String className, java.lang.String baseLocation) throws java.io.IOException
THe file written out is located under #location
, with the path
generated from packageBase
appended.
result
- Result to write to the files.className
- The name of the file to write out.
java.io.IOException
protected void copy(java.io.File file, java.lang.String baseLocation) throws java.io.IOException
THe file written out is located under #location
, with the path
generated from packageBase
appended.
file
- The file to copy.
java.io.IOException
protected java.io.File findSchemaFile(java.lang.String path) throws java.io.IOException
schemaLookupDirectories
.
path
- The path of the file.
java.io.IOException
protected java.io.File outputLocation(java.lang.String baseLocation)
#getLocation()
protected java.lang.String execute(java.lang.String templateName, java.lang.Object input) throws java.lang.ClassNotFoundException, java.lang.RuntimeException
The class of the template is formed by prepending
org.geotools.xml.codegen.
to name
.
templateName
- The non-qualified class name of the template.input
- The input to the template.
java.lang.ClassNotFoundException
- If the template class could not be
found.
java.lang.RuntimeException
- If any exceptions ( ex, relection) occur.
while attempting to execute the template.public void setIncluded(java.util.Set included)
protected boolean included(org.eclipse.xsd.XSDNamedComponent c)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |