public class ClassGenerationAction extends Object
| Constructor and Description |
|---|
ClassGenerationAction() |
| Modifier and Type | Method and Description |
|---|---|
void |
addEmbeddables(Collection<org.apache.cayenne.map.Embeddable> embeddables) |
void |
addEntities(Collection<org.apache.cayenne.map.ObjEntity> entities) |
void |
addQueries(Collection<org.apache.cayenne.map.QueryDescriptor> queries) |
protected String |
customTemplateName(TemplateType type) |
protected String |
defaultTemplateName(TemplateType type) |
void |
execute()
Executes class generation once per each artifact.
|
protected void |
execute(Artifact artifact)
Executes class generation for a single artifact.
|
protected File |
fileForClass()
Returns a target file where a generated class must be saved.
|
protected File |
fileForSuperclass()
Returns a target file where a generated superclass must be saved.
|
protected String |
getSuperclassPrefix()
Returns a String used to prefix class name to create a generated
superclass.
|
protected org.apache.velocity.Template |
getTemplate(TemplateType type) |
protected boolean |
isOld(File file)
Returns true if
file parameter is older than internal
timestamp of this class generator. |
protected File |
mkpath(File dest,
String pkgName)
Returns a File object corresponding to a directory where files that
belong to
pkgName package should reside. |
protected Writer |
openWriter(TemplateType templateType)
Opens a Writer to write generated output.
|
protected void |
resetContextForArtifact(Artifact artifact)
VelocityContext initialization method called once per artifact.
|
protected void |
resetContextForArtifactTemplate(Artifact artifact,
TemplateType templateType)
VelocityContext initialization method called once per each artifact and
template type combination.
|
void |
setArtifactsGenerationMode(String mode) |
void |
setContext(org.apache.velocity.VelocityContext context)
Sets an optional shared VelocityContext.
|
void |
setCreatePropertyNames(boolean createPropertyNames)
Sets
createPropertyNames property. |
void |
setDataMap(org.apache.cayenne.map.DataMap dataMap) |
void |
setDestDir(File destDir)
Sets the destDir.
|
void |
setEmbeddableSuperTemplate(String embeddableSuperTemplate) |
void |
setEmbeddableTemplate(String embeddableTemplate) |
void |
setEncoding(String encoding)
Sets file encoding.
|
void |
setLogger(org.slf4j.Logger logger)
Injects an optional logger that will be used to trace generated files at
the info level.
|
void |
setMakePairs(boolean makePairs)
Sets
makepairs property. |
void |
setOutputPattern(String outputPattern)
Sets
outputPattern property. |
void |
setOverwrite(boolean overwrite)
Sets
overwrite property. |
void |
setQuerySuperTemplate(String querySuperTemplate) |
void |
setQueryTemplate(String queryTemplate) |
void |
setSuperPkg(String superPkg)
Sets "superPkg" property value.
|
void |
setSuperTemplate(String superTemplate)
Sets
superTemplate property. |
void |
setTemplate(String template)
Sets
template property. |
void |
setTimestamp(long timestamp) |
void |
setUsePkgPath(boolean usePkgPath)
Sets
usepkgpath property. |
protected void |
validateAttributes()
Validates the state of this class generator.
|
public static final String SINGLE_CLASS_TEMPLATE
public static final String SUBCLASS_TEMPLATE
public static final String SUPERCLASS_TEMPLATE
public static final String EMBEDDABLE_SINGLE_CLASS_TEMPLATE
public static final String EMBEDDABLE_SUBCLASS_TEMPLATE
public static final String EMBEDDABLE_SUPERCLASS_TEMPLATE
public static final String DATAMAP_SINGLE_CLASS_TEMPLATE
public static final String DATAMAP_SUBCLASS_TEMPLATE
public static final String DATAMAP_SUPERCLASS_TEMPLATE
public static final String SUPERCLASS_PREFIX
protected Collection<Artifact> artifacts
protected String superPkg
protected org.apache.cayenne.map.DataMap dataMap
protected ArtifactsGenerationMode artifactsGenerationMode
protected boolean makePairs
protected org.slf4j.Logger logger
protected File destDir
protected boolean overwrite
protected boolean usePkgPath
protected String template
protected String superTemplate
protected String embeddableTemplate
protected String embeddableSuperTemplate
protected String queryTemplate
protected String querySuperTemplate
protected long timestamp
protected String outputPattern
protected String encoding
protected boolean createPropertyNames
protected org.apache.velocity.VelocityContext context
protected String defaultTemplateName(TemplateType type)
protected String customTemplateName(TemplateType type)
protected String getSuperclassPrefix()
protected void resetContextForArtifact(Artifact artifact)
protected void resetContextForArtifactTemplate(Artifact artifact, TemplateType templateType)
public void execute()
throws Exception
Exceptionprotected void execute(Artifact artifact) throws Exception
Exceptionprotected org.apache.velocity.Template getTemplate(TemplateType type) throws Exception
Exceptionprotected void validateAttributes()
public void setDestDir(File destDir)
public void setOverwrite(boolean overwrite)
overwrite property.public void setMakePairs(boolean makePairs)
makepairs property.public void setTemplate(String template)
template property.public void setSuperTemplate(String superTemplate)
superTemplate property.public void setQueryTemplate(String queryTemplate)
public void setQuerySuperTemplate(String querySuperTemplate)
public void setUsePkgPath(boolean usePkgPath)
usepkgpath property.public void setOutputPattern(String outputPattern)
outputPattern property.public void setCreatePropertyNames(boolean createPropertyNames)
createPropertyNames property.protected Writer openWriter(TemplateType templateType) throws Exception
Exceptionprotected File fileForSuperclass() throws Exception
Exceptionprotected File fileForClass() throws Exception
Exceptionprotected boolean isOld(File file)
file parameter is older than internal
timestamp of this class generator.protected File mkpath(File dest, String pkgName) throws Exception
pkgName package should reside. Creates any missing
diectories below dest.Exceptionpublic void setTimestamp(long timestamp)
public void setEncoding(String encoding)
public void setSuperPkg(String superPkg)
public void setDataMap(org.apache.cayenne.map.DataMap dataMap)
dataMap - The dataMap to set.public void addEntities(Collection<org.apache.cayenne.map.ObjEntity> entities) throws org.apache.cayenne.CayenneException
entities - org.apache.cayenne.CayenneExceptionpublic void addEmbeddables(Collection<org.apache.cayenne.map.Embeddable> embeddables)
public void addQueries(Collection<org.apache.cayenne.map.QueryDescriptor> queries)
public void setContext(org.apache.velocity.VelocityContext context)
public void setLogger(org.slf4j.Logger logger)
public void setEmbeddableTemplate(String embeddableTemplate)
public void setEmbeddableSuperTemplate(String embeddableSuperTemplate)
public void setArtifactsGenerationMode(String mode)
Copyright © 2001–2017 Apache Cayenne. All rights reserved.