org.javagen.agile.core.emitter
Class TemplateEmitter

java.lang.Object
  extended by org.javagen.agile.core.emitter.TemplateEmitter
All Implemented Interfaces:
ContextHolder, Emitter

public class TemplateEmitter
extends Object
implements ContextHolder, Emitter

This emitter utillizes a template engine to generate artifacts. It has the following attributes:

    1) a template instance
        2) an Artifact instance 
        3) an optional local context
        4) a reference to a TemplateGenerator
        5) a optional emitCondition Predicate
 

Author:
Richard Easterling

Field Summary
protected  Artifact artifact
           
protected  Map<String,Object> context
           
protected  Predicate emitCondition
           
protected  String relativeFilePathProperty
           
protected  String sourceDirectoryProperty
           
protected  TemplateGenerator templateGenerator
           
protected  String templatePath
           
 
Constructor Summary
TemplateEmitter()
           
 
Method Summary
 void emit(Context context)
          invoke an emitter
 Artifact getArtifact()
          The unique artifact instance that provides the file name and path to this emitter.
 Map<String,Object> getContext()
           
 Predicate getEmitCondition()
           
 String getRelativeFilePathProperty()
           
 String getSourceDirectoryProperty()
           
 TemplateGenerator getTemplateGenerator()
           
 String getTemplatePath()
           
 void putContext(String key, Object value)
           
 void setArtifact(Artifact artifact)
           
 void setContext(Map<String,Object> context)
           
 void setEmitCondition(Predicate predicate)
           
 void setRelativeFilePathProperty(String relativeFilePathProperty)
           
 void setSourceDirectoryProperty(String sourceDirectoryProperty)
           
 void setTemplateGenerator(TemplateGenerator templateGenerator)
           
 void setTemplatePath(String templatePath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

templatePath

protected String templatePath

context

protected Map<String,Object> context

emitCondition

protected Predicate emitCondition

artifact

protected Artifact artifact

templateGenerator

protected TemplateGenerator templateGenerator

sourceDirectoryProperty

protected String sourceDirectoryProperty

relativeFilePathProperty

protected String relativeFilePathProperty
Constructor Detail

TemplateEmitter

public TemplateEmitter()
Method Detail

emit

public void emit(Context context)
Description copied from interface: Emitter
invoke an emitter

Specified by:
emit in interface Emitter
Parameters:
context - - usually a composite of leaf, parent and template contexts.

getContext

public Map<String,Object> getContext()
Specified by:
getContext in interface ContextHolder
Returns:
either a map instance populated with key-value pairs or null

setContext

public void setContext(Map<String,Object> context)

getTemplatePath

public String getTemplatePath()

setTemplatePath

public void setTemplatePath(String templatePath)

getEmitCondition

public Predicate getEmitCondition()

setEmitCondition

public void setEmitCondition(Predicate predicate)

putContext

public void putContext(String key,
                       Object value)

getArtifact

public Artifact getArtifact()
Description copied from interface: Emitter
The unique artifact instance that provides the file name and path to this emitter.

WARNING: Artifact instances should not be shared between different emitters.

Specified by:
getArtifact in interface Emitter
Returns:
the artifact associated with this emitter

setArtifact

public void setArtifact(Artifact artifact)

getTemplateGenerator

public TemplateGenerator getTemplateGenerator()

setTemplateGenerator

public void setTemplateGenerator(TemplateGenerator templateGenerator)

getRelativeFilePathProperty

public String getRelativeFilePathProperty()

setRelativeFilePathProperty

public void setRelativeFilePathProperty(String relativeFilePathProperty)

getSourceDirectoryProperty

public String getSourceDirectoryProperty()

setSourceDirectoryProperty

public void setSourceDirectoryProperty(String sourceDirectoryProperty)


Copyright 2006-2006-2007 Outsource Cafe Inc.. All Rights Reserved.