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 f0203ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 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.
By default, the simple name of the enclosing 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
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

/**
* Constant value for {@link #basePath()} indicating that the default strategy should be used, i.e. the simple name of the
* declaring class for a nested static class or an empty string for a top level class.
* enclosing class for a nested static class or an empty string for a top level class.
*/
String DEFAULTED = "<<defaulted>>";

Expand Down

0 comments on commit f0203ec

Please sign in to comment.