Package rife.template
Class TemplateFactory
Factory for creating RIFE2 template instances.
- Since:
- 1.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic TemplateFactory
static TemplateFactory
static TemplateFactory
static TemplateFactory
static TemplateFactory
static TemplateFactory
Fields inherited from class rife.datastructures.EnumClass
identifier_
-
Constructor Summary
ConstructorDescriptionTemplateFactory
(TemplateConfig config, String identifier, TemplateFactory base) TemplateFactory
(TemplateConfig config, ResourceFinder resourceFinder, String identifier, String defaultContentType, String extension, String[] blockFilters, String[] valueFilters, BeanHandler beanHandler, TemplateEncoder encoder, TemplateInitializer initializer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
generateTemplate
(String name, String encoding, String generationPath) Creates a newTemplate
instance for this factory using the default encoding.Creates a newTemplate
instance for this factory using the default encoding.static TemplateFactory
getFactory
(String identifier) static Collection<String>
void
setBeanHandler
(BeanHandler beanHandler) setEncoder
(TemplateEncoder encoder) setInitializer
(TemplateInitializer initializer) setResourceFinder
(ResourceFinder resourceFinder) Methods inherited from class rife.datastructures.EnumClass
equals, getIdentifier, getIdentifiers, getMember, getMembers, hashCode, registerType, toString
-
Field Details
-
HTML
-
XML
-
SVG
-
TXT
-
SQL
-
JSON
-
-
Constructor Details
-
TemplateFactory
public TemplateFactory(TemplateConfig config, ResourceFinder resourceFinder, String identifier, String defaultContentType, String extension, String[] blockFilters, String[] valueFilters, BeanHandler beanHandler, TemplateEncoder encoder, TemplateInitializer initializer) -
TemplateFactory
-
-
Method Details
-
getIdentifierUppercase
-
getDefaultContentType
-
getFactoryTypes
-
getFactory
-
get
Creates a newTemplate
instance for this factory using the default encoding.Please read
get(String, String)
for important additional information.- Parameters:
name
- the name of the template- Returns:
- the new template instance
- Throws:
TemplateException
- when an error occurred during the parsing or instantiation of the template- Since:
- 1.0
- See Also:
-
get
Creates a newTemplate
instance for this factory using the default encoding.RIFE2's templates are parsed and converted into JVM bytecode. Each template effectively becomes a highly optimized Java class that is loaded by the regular classloader. This limits the characters that can be used for template names to the characters that Java accepts for class names.
The characters that are invalid Java class name characters will be replaced by underscores, except for
/
and\
, which will be replaced by dots. The changes to the template name will propagate through to the template source file name that RIFE2 is looking for.- Parameters:
name
- the name of the templateencoding
- the text encoding of the template file- Returns:
- the new template instance
- Throws:
TemplateException
- when an error occurred during the parsing or instantiation of the template- Since:
- 1.0
- See Also:
-
generateTemplate
-
parse
- Throws:
TemplateException
-
getConfig
-
setResourceFinder
-
getResourceFinder
-
setBeanHandler
-
getBeanHandler
-
setEncoder
-
getEncoder
-
setInitializer
-
getInitializer
-
resetClassLoader
public void resetClassLoader()
-