Skip to content

Commit 01e00e6

Browse files
committed
Sync documentation of main branch
1 parent 91cb50b commit 01e00e6

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

_generated-doc/main/infra/quarkus-all-build-items.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,6 +1930,10 @@ _No Javadoc found_
19301930

19311931
_No Javadoc found_
19321932

1933+
`boolean publicConstructors`
1934+
1935+
_No Javadoc found_
1936+
19331937
`boolean queryConstructors`
19341938

19351939
_No Javadoc found_

_versions/main/guides/qute-reference.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,44 @@ class ItemService {
20952095

20962096
NOTE: You can specify `@CheckedTemplate#ignoreFragments=true` in order to disable this feature, i.e. a dollar sign `$` in the method name will not result in a checked fragment method.
20972097

2098+
[[template_contents]]
2099+
==== Template Contents
2100+
2101+
It is also possible to specify the contents for a type-safe template directly in your Java code.
2102+
A `static native` method of a class annotated with `@CheckedTemplate` or a Java record that implements `TemplateInstance` may be annotated with `@io.quarkus.qute.TemplateContents`.
2103+
The annotation value is used as the template contents.
2104+
The template id/path is derived from the type-safe template.
2105+
2106+
.Template Contents Example
2107+
[source,java]
2108+
----
2109+
package org.acme.quarkus.sample;
2110+
2111+
import jakarta.inject.Inject;
2112+
import jakarta.ws.rs.GET;
2113+
import jakarta.ws.rs.Path;
2114+
import jakarta.ws.rs.QueryParam;
2115+
import jakarta.ws.rs.Produces;
2116+
import jakarta.ws.rs.core.MediaType;
2117+
2118+
import io.quarkus.qute.TemplateContents;
2119+
import io.quarkus.qute.TemplateInstance;
2120+
2121+
@Path("hello")
2122+
public class HelloResource {
2123+
2124+
@TemplateContents("Hello {name}!") <1>
2125+
record Hello(String name) implements TemplateInstance {}
2126+
2127+
@GET
2128+
@Produces(MediaType.TEXT_PLAIN)
2129+
public TemplateInstance get(@QueryParam("name") String name) {
2130+
return new Hello(name);
2131+
}
2132+
}
2133+
----
2134+
<1> Defines the contents for the type-safe template represented by the `Hello` record. The derived template id is `HelloResource/Hello`.
2135+
20982136
[[template_extension_methods]]
20992137
=== Template Extension Methods
21002138

0 commit comments

Comments
 (0)