Package io.quarkus.qute
Interface TemplateInstance
- All Known Implementing Classes:
TemplateInstanceBase
public interface TemplateInstance
Represents an instance of
Template.
This construct is not thread-safe.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis component can be used to initialize a template instance, i.e. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault CompletionStage<Void>Triggers rendering.default io.smallrye.mutiny.Multi<String>Create a newMultithat can be used to consume chunks of the rendered template.default io.smallrye.mutiny.Uni<String>Create a newUnithat can be used to consume the rendered template.default TemplateInstanceSet the the root data object.default TemplateInstancePut the data in a map.default ObjectgetAttribute(String key) default TemplategetFragment(String id) default Templatedefault longdefault TemplateInstanceonRendered(Runnable action) Register an action that is performed after the rendering is finished.default Stringrender()Triggers rendering.default CompletionStage<String>Triggers rendering.default TemplateInstancesetAttribute(String key, Object value)
-
Field Details
-
TIMEOUT
Attribute key - the timeout forrender()in milliseconds.- See Also:
-
VARIANTS
Attribute key - all template variants found.- See Also:
-
SELECTED_VARIANT
Attribute key - a selected variant.- See Also:
-
-
Method Details
-
data
Set the the root data object. Invocation of this method removes any data set previously bydata(String, Object).- Parameters:
data-- Returns:
-
data
Put the data in a map. The map will be used as the root context object during rendering. Invocation of this method removes the root data object previously set bydata(Object).- Parameters:
key-data-- Returns:
- self
-
setAttribute
- Parameters:
key-value-- Returns:
- self
-
getAttribute
- Parameters:
key-- Returns:
- the attribute or null
-
render
Triggers rendering. Note that this method blocks the current thread!- Returns:
- the rendered template as string
-
renderAsync
Triggers rendering.- Returns:
- a completion stage that is completed once the rendering finished
-
createMulti
Create a newMultithat can be used to consume chunks of the rendered template. In particular, each item represents a part of the rendered template.This operation does not trigger rendering. Instead, each subscription triggers a new rendering of the template.
- Returns:
- a new Multi
- See Also:
-
Multi.subscribe()
-
createUni
Create a newUnithat can be used to consume the rendered template.This operation does not trigger rendering. Instead, each subscription triggers a new rendering of the template.
- Returns:
- a new Uni
- See Also:
-
Uni.subscribe()
-
consume
Triggers rendering.- Parameters:
consumer- To consume chunks of the rendered template- Returns:
- a completion stage that is completed once the rendering finished
-
getTimeout
default long getTimeout()- Returns:
- the timeout
- See Also:
-
getTemplate
- Returns:
- the original template
-
getFragment
- Parameters:
id-- Returns:
- the fragment or
null - See Also:
-
onRendered
Register an action that is performed after the rendering is finished.- Parameters:
action-- Returns:
- self
-