Package io.quarkus.qute
Interface Template
- All Known Subinterfaces:
Template.Fragment
public interface Template
Represents an immutable template definition.
The workflow is as follows:
- Create a new template instance via
instance()or any convenient method - Set the model data
- Trigger rendering with
TemplateInstance.render()or any other convenient methods
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA fragment represents a part of the template that can be treated as a separate template. -
Method Summary
Modifier and TypeMethodDescriptiondefault TemplateInstancedefault TemplateInstancedefault TemplateInstancedefault TemplateInstancedefault TemplateInstancedata(String key1, Object data1, String key2, Object data2, String key3, Object data3, String key4, Object data4) default TemplateInstancedata(String key1, Object data1, String key2, Object data2, String key3, Object data3, String key4, Object data4, String key5, Object data5) findExpression(Predicate<Expression> predicate) If invoked upon a fragment instance then delegate to the defining template.If invoked upon a fragment instance then delegate to the defining template.getFragment(String id) Attempts to find the fragment with the specified identifier.Returns an immutable set of identifiers of fragments defined in the template.The id is unique for the engine instance.getId()An identifier used to obtain the template from the engine.Returns all type parameter declarations of the template, including the declarations added by aParserHook.If invoked upon a fragment instance then delegate to the defining template.instance()Create a new template instance to configure the model data.default booleandefault Stringrender()default String
-
Method Details
-
instance
TemplateInstance instance()Create a new template instance to configure the model data.- Returns:
- a new template instance
- See Also:
-
data
- Parameters:
data-- Returns:
- a new template instance
- See Also:
-
data
- Parameters:
key-data-- Returns:
- a new template instance
- See Also:
-
data
- Parameters:
key1-data1-key2-data2-- Returns:
- a new template instance
-
data
default TemplateInstance data(String key1, Object data1, String key2, Object data2, String key3, Object data3) - Parameters:
key1-data1-key2-data2-key3-data3-- Returns:
- a new template instance
-
data
default TemplateInstance data(String key1, Object data1, String key2, Object data2, String key3, Object data3, String key4, Object data4) - Parameters:
key1-data1-key2-data2-key3-data3-key4-data4-- Returns:
- a new template instance
-
data
default TemplateInstance data(String key1, Object data1, String key2, Object data2, String key3, Object data3, String key4, Object data4, String key5, Object data5) - Parameters:
key1-data1-key2-data2-key3-data3-key4-data4-key5-data5-- Returns:
- a new template instance
-
render
-
render
-
getExpressions
List<Expression> getExpressions()If invoked upon a fragment instance then delegate to the defining template.- Returns:
- an immutable list of expressions used in the template
-
findExpression
If invoked upon a fragment instance then delegate to the defining template.- Parameters:
predicate-- Returns:
- the first expression matching the given predicate or
nullif no such expression is used in the template
-
getGeneratedId
String getGeneratedId()The id is unique for the engine instance.- Returns:
- the generated id
-
getId
String getId()An identifier used to obtain the template from the engine.- Returns:
- the identifier
- See Also:
-
getVariant
If invoked upon a fragment instance then delegate to the defining template.- Returns:
- the template variant
-
getParameterDeclarations
List<ParameterDeclaration> getParameterDeclarations()Returns all type parameter declarations of the template, including the declarations added by aParserHook.If invoked upon a fragment instance then delegate to the defining template.
- Returns:
- an immutable list of all type parameter declarations defined in the template
-
getFragment
Attempts to find the fragment with the specified identifier.Note that fragment identifiers must be unique in a template.
If invoked upon a fragment instance then delegate to the defining template.
- Parameters:
id- The fragment identifier- Returns:
- the fragment or
null
-
getFragmentIds
Returns an immutable set of identifiers of fragments defined in the template.If invoked upon a fragment instance then delegate to the defining template.
- Returns:
- the set of fragment ids
-
isFragment
default boolean isFragment()- Returns:
trueif this template is a fragment,falseotherwise
-