Skip to content

Commit

Permalink
Qute docs: clarify template record not annotated with @CheckedTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
mkouba committed Aug 28, 2024
1 parent d340996 commit 5aa0ffa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/src/main/asciidoc/qute-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1942,17 +1942,19 @@ public class HelloResource {
}
}
----
<1> Declares a type-safe template with the Java record.
<1> Declares a type-safe template with the Java record. The template is located at `/src/main/resources/templates/HelloResource/Hello.html`.
<2> Instantiate the record and use it as an ordinary `TemplateInstance`.


==== Customized Template Path

The template path of a `@CheckedTemplate` method consists of the _base path_ and a _defaulted name_.
The path of a type-safe template (`@CheckedTemplate` method or record) consists of a _base path_ and a _defaulted name_.
The _base path_ is supplied by the `@CheckedTemplate#basePath()`.
By default, the simple name of the declaring class for a nested static class or an empty string for a top level class is used.
The _defaulted name_ is derived by the strategy specified in `@CheckedTemplate#defaultName()`.
By default, the name of the `@CheckedTemplate` method is used as is.
By default, the name of the `@CheckedTemplate` method/record is used as is.

NOTE: A template record that is not annotated with `@CheckedTemplate` is treated as if it was annotated with `@CheckedTemplate` with default values.

.Customized Template Path Example
[source,java]
Expand Down

0 comments on commit 5aa0ffa

Please sign in to comment.