Skip to content

Commit

Permalink
wrong method name
Browse files Browse the repository at this point in the history
  • Loading branch information
cayhorstmann committed Oct 15, 2023
1 parent bc8ec1d commit fd35e05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions site/content/features/stringtemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public class TemplateProcessors {

## The `StringTemplate` class

When a template expression is evaluated, the template arguments are placed in an object that is then passed to the `format` method of the template processor.
When a template expression is evaluated, the template arguments are placed in an object that is then passed to the `process` method of the template processor.

The name `StringTemplate` is perhaps unfortunate. *Any* of the four possible template argument types is turned into a `StringTemplate` instance. `TemplateArguments` might have been a better choice for the class name.

Expand Down Expand Up @@ -308,7 +308,7 @@ public class StringTemplateDemo {

## Writing Your Own Template Processor

The `format` method of a template processor turns `StringTemplate` instances into objects. Since `StringTemplate.Processor` is a functional interface, you can construct an instance from a lambda expression. Here is a simple example that places the values in boxes:
The `process` method of a template processor turns `StringTemplate` instances into objects. Since `StringTemplate.Processor` is a functional interface, you can construct an instance from a lambda expression. Here is a simple example that places the values in boxes:

{{< sandbox version=java21 preview="true" mainclass="MyFirstTemplateProcessor" >}}{{< sandboxsource "MyFirstTemplateProcessor.java" >}}
public class MyFirstTemplateProcessor {
Expand Down

0 comments on commit fd35e05

Please sign in to comment.