|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.gen.ClassGenerationAction
public class ClassGenerationAction
Field Summary | |
---|---|
protected Collection<Artifact> |
artifacts
|
protected ArtifactsGenerationMode |
artifactsGenerationMode
|
protected org.apache.velocity.VelocityContext |
context
|
protected DataMap |
dataMap
|
protected File |
destDir
|
static String |
EMBEDDABLE_SINGLE_CLASS_TEMPLATE
|
static String |
EMBEDDABLE_SUBCLASS_TEMPLATE
|
static String |
EMBEDDABLE_SUPERCLASS_TEMPLATE
|
protected String |
embeddableSuperTemplate
|
protected String |
embeddableTemplate
|
protected String |
encoding
|
protected org.apache.commons.logging.Log |
logger
|
protected boolean |
makePairs
|
protected String |
outputPattern
|
protected boolean |
overwrite
|
static String |
SINGLE_CLASS_TEMPLATE
|
static String |
SUBCLASS_TEMPLATE
|
static String |
SUPERCLASS_PREFIX
|
static String |
SUPERCLASS_TEMPLATE
|
protected String |
superPkg
|
protected String |
superTemplate
|
protected String |
template
|
protected Map<String,org.apache.velocity.Template> |
templateCache
|
protected long |
timestamp
|
protected boolean |
usePkgPath
|
Constructor Summary | |
---|---|
ClassGenerationAction()
|
Method Summary | |
---|---|
void |
addEmbeddables(Collection<Embeddable> embeddables)
|
void |
addEntities(Collection<ObjEntity> entities)
Adds entities to the internal entity list. |
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 |
setDataMap(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.apache.commons.logging.Log 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 |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 SUPERCLASS_PREFIX
protected Collection<Artifact> artifacts
protected String superPkg
protected DataMap dataMap
protected ArtifactsGenerationMode artifactsGenerationMode
protected boolean makePairs
protected org.apache.commons.logging.Log logger
protected File destDir
protected boolean overwrite
protected boolean usePkgPath
protected String template
protected String superTemplate
protected String embeddableTemplate
protected String embeddableSuperTemplate
protected long timestamp
protected String outputPattern
protected String encoding
protected org.apache.velocity.VelocityContext context
protected Map<String,org.apache.velocity.Template> templateCache
Constructor Detail |
---|
public ClassGenerationAction()
Method Detail |
---|
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
Exception
protected void execute(Artifact artifact) throws Exception
Exception
protected org.apache.velocity.Template getTemplate(TemplateType type) throws Exception
Exception
protected 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 setUsePkgPath(boolean usePkgPath)
usepkgpath
property.
public void setOutputPattern(String outputPattern)
outputPattern
property.
protected Writer openWriter(TemplateType templateType) throws Exception
Exception
protected File fileForSuperclass() throws Exception
Exception
protected File fileForClass() throws Exception
Exception
protected 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
.
Exception
public void setTimestamp(long timestamp)
public void setEncoding(String encoding)
public void setSuperPkg(String superPkg)
public void setDataMap(DataMap dataMap)
dataMap
- The dataMap to set.public void addEntities(Collection<ObjEntity> entities)
public void addEmbeddables(Collection<Embeddable> embeddables)
public void setContext(org.apache.velocity.VelocityContext context)
public void setLogger(org.apache.commons.logging.Log logger)
public void setEmbeddableTemplate(String embeddableTemplate)
public void setEmbeddableSuperTemplate(String embeddableSuperTemplate)
public void setArtifactsGenerationMode(String mode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |