com.agimatec.commons.generator
Class FreemarkerFileGenerator

java.lang.Object
  extended by com.agimatec.commons.generator.FreemarkerFileGenerator

public class FreemarkerFileGenerator
extends java.lang.Object

Description:
User: roman.stumm
Date: 27.04.2007
Time: 17:57:39
Copyright: Agimatec GmbH


Field Summary
protected  freemarker.template.Configuration freemarker
           
protected static org.apache.commons.logging.Log log
           
static java.io.Writer NullWriter
           
static java.lang.String UTF8
           
 
Constructor Summary
FreemarkerFileGenerator(java.io.File templateDir)
           
 
Method Summary
 java.util.List exeptFirst(java.util.Collection coll)
           
 java.util.List exeptLast(java.util.Collection coll)
           
 java.lang.Object first(java.util.Collection coll)
           
 void generate()
           
 void generate(java.io.Writer out)
           
 java.lang.String getBaseDir()
           
 java.lang.String getCharset()
           
 java.io.File getDestFile()
           
 java.lang.String getDestFileName()
           
 freemarker.template.Configuration getFreemarker()
           
 java.util.Map getRoot()
           
 java.lang.String getTemplateName()
           
 java.lang.Object last(java.util.Collection coll)
           
 void outputToFile(java.lang.String newDestFile)
          Utility method for templates that need to change the output file during template processing!
 void outputToNull()
          Utility method for template to write template output to 'nothing'.
 void outputToWriter(java.io.Writer outWriter)
          Utility method for template to write to the given writer
 void putModel(java.lang.String name, java.lang.Object obj)
           
 void setBaseDir(java.lang.String baseDir)
           
 void setCharset(java.lang.String charset)
           
 void setDestFileName(java.lang.String target)
           
 void setTemplateName(java.lang.String templateName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

freemarker

protected freemarker.template.Configuration freemarker

UTF8

public static final java.lang.String UTF8
See Also:
Constant Field Values

NullWriter

public static final java.io.Writer NullWriter
Constructor Detail

FreemarkerFileGenerator

public FreemarkerFileGenerator(java.io.File templateDir)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setTemplateName

public void setTemplateName(java.lang.String templateName)

setCharset

public void setCharset(java.lang.String charset)

setDestFileName

public void setDestFileName(java.lang.String target)

putModel

public void putModel(java.lang.String name,
                     java.lang.Object obj)

getRoot

public java.util.Map getRoot()

getTemplateName

public java.lang.String getTemplateName()

getCharset

public java.lang.String getCharset()

getDestFileName

public java.lang.String getDestFileName()

getBaseDir

public java.lang.String getBaseDir()

setBaseDir

public void setBaseDir(java.lang.String baseDir)

generate

public void generate()
              throws java.io.IOException,
                     freemarker.template.TemplateException
Throws:
java.io.IOException
freemarker.template.TemplateException

generate

public void generate(java.io.Writer out)
              throws java.io.IOException,
                     freemarker.template.TemplateException
Throws:
java.io.IOException
freemarker.template.TemplateException

getDestFile

public java.io.File getDestFile()

outputToFile

public void outputToFile(java.lang.String newDestFile)
                  throws java.io.IOException
Utility method for templates that need to change the output file during template processing!

Throws:
java.io.IOException
See Also:
outputToNull()

outputToNull

public void outputToNull()
                  throws java.io.IOException
Utility method for template to write template output to 'nothing'.

Throws:
java.io.IOException
See Also:
outputToFile(String)

outputToWriter

public void outputToWriter(java.io.Writer outWriter)
                    throws java.io.IOException
Utility method for template to write to the given writer

Parameters:
outWriter -
Throws:
java.io.IOException

getFreemarker

public freemarker.template.Configuration getFreemarker()

exeptLast

public java.util.List exeptLast(java.util.Collection coll)

last

public java.lang.Object last(java.util.Collection coll)

exeptFirst

public java.util.List exeptFirst(java.util.Collection coll)

first

public java.lang.Object first(java.util.Collection coll)


Copyright © 2008-2012. All Rights Reserved.