Skip to content

Commit

Permalink
Sync documentation of main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 14, 2025
1 parent 91cb50b commit 01e00e6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _generated-doc/main/infra/quarkus-all-build-items.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,10 @@ _No Javadoc found_

_No Javadoc found_

`boolean publicConstructors`

_No Javadoc found_

`boolean queryConstructors`

_No Javadoc found_
Expand Down
38 changes: 38 additions & 0 deletions _versions/main/guides/qute-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,44 @@ class ItemService {

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.

[[template_contents]]
==== Template Contents

It is also possible to specify the contents for a type-safe template directly in your Java code.
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`.
The annotation value is used as the template contents.
The template id/path is derived from the type-safe template.

.Template Contents Example
[source,java]
----
package org.acme.quarkus.sample;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import io.quarkus.qute.TemplateContents;
import io.quarkus.qute.TemplateInstance;
@Path("hello")
public class HelloResource {
@TemplateContents("Hello {name}!") <1>
record Hello(String name) implements TemplateInstance {}
@GET
@Produces(MediaType.TEXT_PLAIN)
public TemplateInstance get(@QueryParam("name") String name) {
return new Hello(name);
}
}
----
<1> Defines the contents for the type-safe template represented by the `Hello` record. The derived template id is `HelloResource/Hello`.

[[template_extension_methods]]
=== Template Extension Methods

Expand Down

0 comments on commit 01e00e6

Please sign in to comment.