Package io.github.erdos.stencil
Class API
- java.lang.Object
-
- io.github.erdos.stencil.API
-
public final class API extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PreparedFragment
fragment(java.io.File fragmentFile)
static PreparedFragment
fragment(java.io.File fragmentFile, PrepareOptions options)
Prepares a document fragment from the file system.static PreparedTemplate
prepare(java.io.File templateFile)
Prepares a document template file from the file system.static PreparedTemplate
prepare(java.io.File templateFile, PrepareOptions options)
Prepares a document template file from the file system.static EvaluatedDocument
render(PreparedTemplate template, TemplateData data)
static EvaluatedDocument
render(PreparedTemplate template, java.util.Map<java.lang.String,PreparedFragment> fragments, TemplateData data)
static EvaluatedDocument
render(PreparedTemplate template, java.util.Map<java.lang.String,PreparedFragment> fragments, TemplateData data, java.util.Collection<Function> customFunctions)
-
-
-
Method Detail
-
prepare
public static PreparedTemplate prepare(java.io.File templateFile) throws java.io.IOException
Prepares a document template file from the file system.- Throws:
java.io.IOException
-
prepare
public static PreparedTemplate prepare(java.io.File templateFile, PrepareOptions options) throws java.io.IOException
Prepares a document template file from the file system.- Throws:
java.io.IOException
-
fragment
public static PreparedFragment fragment(java.io.File fragmentFile, PrepareOptions options) throws java.io.IOException
Prepares a document fragment from the file system. Fragments can be used to embed extra content when rendering document templates. For example, custom headers and footers can be reused across documents this way.- Parameters:
fragmentFile
- template file from file system to be used as document fragment- Returns:
- fragment instance, not null
- Throws:
java.lang.IllegalArgumentException
- when fragmentFile is nulljava.io.IOException
- on file system errorjava.io.FileNotFoundException
- when file is not found on file system
-
fragment
public static PreparedFragment fragment(java.io.File fragmentFile) throws java.io.IOException
- Throws:
java.io.IOException
-
render
public static EvaluatedDocument render(PreparedTemplate template, TemplateData data)
-
render
public static EvaluatedDocument render(PreparedTemplate template, java.util.Map<java.lang.String,PreparedFragment> fragments, TemplateData data)
-
render
public static EvaluatedDocument render(PreparedTemplate template, java.util.Map<java.lang.String,PreparedFragment> fragments, TemplateData data, java.util.Collection<Function> customFunctions)
-
-