Package io.quarkus.qute
Interface Engine
-
- All Superinterfaces:
ErrorInitializer
public interface Engine extends ErrorInitializer
Represents a central point for template management.It has a dedicated configuration and is able to cache the template definitions.
- See Also:
EngineBuilder
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static EngineBuilderbuilder()voidclearTemplates()Removes all templates from the cache.EvaluatorgetEvaluator()List<NamespaceResolver>getNamespaceResolvers()List<ResultMapper>getResultMappers()Map<String,SectionHelperFactory<?>>getSectionHelperFactories()SectionHelperFactory<?>getSectionHelperFactory(String name)TemplategetTemplate(String id)Obtain a template for the given identifier.List<TemplateInstance.Initializer>getTemplateInstanceInitializers()longgetTimeout()The global rendering timeout in milliseconds.List<ValueResolver>getValueResolvers()booleanisTemplateLoaded(String id)Note that template locators are not used in this method.StringmapResult(Object result, Expression expression)Maps the given result to a string value.default Templateparse(String content)Parse the template contents.default Templateparse(String content, Variant variant)Parse the template contents with the specified variant.Templateparse(String content, Variant variant, String id)Parse the template contents with the specified variant and id.TemplateputTemplate(String id, Template template)voidremoveTemplates(Predicate<String> test)Removes the templates for which the mapping id matches the given predicate.booleanuseAsyncTimeout()-
Methods inherited from interface io.quarkus.qute.ErrorInitializer
error
-
-
-
-
Method Detail
-
builder
static EngineBuilder builder()
- Returns:
- a new builder instance
-
parse
default Template parse(String content)
Parse the template contents.Note that this method always returns a new
Templateinstance.- Parameters:
content-- Returns:
- the template
-
parse
default Template parse(String content, Variant variant)
Parse the template contents with the specified variant.Note that this method always returns a new
Templateinstance.- Parameters:
content-variant-- Returns:
- the template
-
parse
Template parse(String content, Variant variant, String id)
Parse the template contents with the specified variant and id.Note that this method always returns a new
Templateinstance.- Parameters:
content-variant-id-- Returns:
- the template
-
getResultMappers
List<ResultMapper> getResultMappers()
- Returns:
- an immutable list of result mappers
-
mapResult
String mapResult(Object result, Expression expression)
Maps the given result to a string value. If no result mappers are available theObject.toString()value is used.- Parameters:
result- Must not be nullexpression- Must not be null- Returns:
- the string value
- See Also:
getResultMappers()
-
putTemplate
Template putTemplate(String id, Template template)
- Parameters:
id-template-- Returns:
- the previous value or null
-
getTemplate
Template getTemplate(String id)
Obtain a template for the given identifier. A template may be registered usingputTemplate(String, Template)or loaded by a template locator.- Parameters:
id-- Returns:
- the template or null
- See Also:
EngineBuilder.addLocator(TemplateLocator)
-
isTemplateLoaded
boolean isTemplateLoaded(String id)
Note that template locators are not used in this method.- Parameters:
id-- Returns:
trueif a template with the given identifier is loaded,falseotherwise
-
clearTemplates
void clearTemplates()
Removes all templates from the cache.
-
removeTemplates
void removeTemplates(Predicate<String> test)
Removes the templates for which the mapping id matches the given predicate.- Parameters:
test-
-
getSectionHelperFactory
SectionHelperFactory<?> getSectionHelperFactory(String name)
- Parameters:
name-- Returns:
- the section helper factory for the giben name
-
getSectionHelperFactories
Map<String,SectionHelperFactory<?>> getSectionHelperFactories()
- Returns:
- an immutable map of section helper factories
-
getValueResolvers
List<ValueResolver> getValueResolvers()
- Returns:
- an immutable list of value resolvers
-
getNamespaceResolvers
List<NamespaceResolver> getNamespaceResolvers()
- Returns:
- an immutable list of namespace resolvers
-
getEvaluator
Evaluator getEvaluator()
- Returns:
- the evaluator used to evaluate expressions
-
getTemplateInstanceInitializers
List<TemplateInstance.Initializer> getTemplateInstanceInitializers()
- Returns:
- an immutable list of template instance initializers
-
getTimeout
long getTimeout()
The global rendering timeout in milliseconds. It is used if notimeoutinstance attribute is set.- Returns:
- the global rendering timeout
- See Also:
TemplateInstance.TIMEOUT
-
useAsyncTimeout
boolean useAsyncTimeout()
- Returns:
trueif the timeout should also used for asynchronous rendering methods
-
-