com.github.mustachejava
Class DefaultMustacheFactory

java.lang.Object
  extended by com.github.mustachejava.DefaultMustacheFactory
All Implemented Interfaces:
MustacheFactory

public class DefaultMustacheFactory
extends java.lang.Object
implements MustacheFactory

Simplest possible code factory


Constructor Summary
DefaultMustacheFactory()
           
DefaultMustacheFactory(java.io.File fileRoot)
           
DefaultMustacheFactory(java.lang.String resourceRoot)
           
 
Method Summary
 Mustache compile(java.io.Reader reader, java.lang.String name)
          Create a mustache given a reader and a name.
 Mustache compile(java.io.Reader reader, java.lang.String file, java.lang.String sm, java.lang.String em)
           
 Mustache compile(java.lang.String name)
          Create a mustache given a resource name.
 MustacheVisitor createMustacheVisitor()
          Creates the visitor for compilation.
 void encode(java.lang.String value, java.io.Writer writer)
          This defines how "encoded" values are encoded.
 java.util.concurrent.ExecutorService getExecutorService()
           
 ObjectHandler getObjectHandler()
          The object handler knows how to transform names into fields and methods.
 java.io.Reader getReader(java.lang.String resourceName)
          Given a resource name, construct a reader.
 Mustache getTemplate(java.lang.String templateText)
           
 void putTemplate(java.lang.String templateText, Mustache mustache)
           
 void setExecutorService(java.util.concurrent.ExecutorService es)
           
 void setObjectHandler(ObjectHandler oh)
           
 java.lang.String translate(java.lang.String from)
          Converts your arbitrary name to another name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMustacheFactory

public DefaultMustacheFactory()

DefaultMustacheFactory

public DefaultMustacheFactory(java.lang.String resourceRoot)

DefaultMustacheFactory

public DefaultMustacheFactory(java.io.File fileRoot)
Method Detail

createMustacheVisitor

public MustacheVisitor createMustacheVisitor()
Description copied from interface: MustacheFactory
Creates the visitor for compilation.

Specified by:
createMustacheVisitor in interface MustacheFactory
Returns:
visitor

getReader

public java.io.Reader getReader(java.lang.String resourceName)
Description copied from interface: MustacheFactory
Given a resource name, construct a reader.

Specified by:
getReader in interface MustacheFactory
Parameters:
resourceName - used to find the resource
Returns:
a reader

encode

public void encode(java.lang.String value,
                   java.io.Writer writer)
Description copied from interface: MustacheFactory
This defines how "encoded" values are encoded. It defaults to something appropriate for HTML output.

Specified by:
encode in interface MustacheFactory
Parameters:
value - the unencoded value
writer - where to encode the value

getObjectHandler

public ObjectHandler getObjectHandler()
Description copied from interface: MustacheFactory
The object handler knows how to transform names into fields and methods.

Specified by:
getObjectHandler in interface MustacheFactory
Returns:
the handler

setObjectHandler

public void setObjectHandler(ObjectHandler oh)

getExecutorService

public java.util.concurrent.ExecutorService getExecutorService()

setExecutorService

public void setExecutorService(java.util.concurrent.ExecutorService es)

getTemplate

public Mustache getTemplate(java.lang.String templateText)

putTemplate

public void putTemplate(java.lang.String templateText,
                        Mustache mustache)

compile

public Mustache compile(java.lang.String name)
Description copied from interface: MustacheFactory
Create a mustache given a resource name.

Specified by:
compile in interface MustacheFactory
Parameters:
name - the name of the resource
Returns:
the compiled mustache

compile

public Mustache compile(java.io.Reader reader,
                        java.lang.String name)
Description copied from interface: MustacheFactory
Create a mustache given a reader and a name.

Specified by:
compile in interface MustacheFactory
Parameters:
reader - the reader
name - the name of the resource
Returns:
the compiled mustache

compile

public Mustache compile(java.io.Reader reader,
                        java.lang.String file,
                        java.lang.String sm,
                        java.lang.String em)

translate

public java.lang.String translate(java.lang.String from)
Description copied from interface: MustacheFactory
Converts your arbitrary name to another name.

Specified by:
translate in interface MustacheFactory
Parameters:
from - the tag to replace
Returns:
the new tag


Copyright © 2012. All Rights Reserved.