Class StTemplateRenderer.Builder
java.lang.Object
org.springframework.ai.template.st.StTemplateRenderer.Builder
- Enclosing class:
- StTemplateRenderer
Builder for configuring and creating
StTemplateRenderer
instances.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a newStTemplateRenderer
instance with the configured settings.endDelimiterToken
(char endDelimiterToken) Sets the character used as the end delimiter for template expressions.startDelimiterToken
(char startDelimiterToken) Sets the character used as the start delimiter for template expressions.Configures the renderer to support StringTemplate's built-in functions during validation.validationMode
(ValidationMode validationMode) Sets the validation mode to control behavior when the provided variables do not match the variables required by the template.
-
Method Details
-
startDelimiterToken
Sets the character used as the start delimiter for template expressions. Default is '{'.- Parameters:
startDelimiterToken
- The start delimiter character.- Returns:
- This builder instance for chaining.
-
endDelimiterToken
Sets the character used as the end delimiter for template expressions. Default is '}'.- Parameters:
endDelimiterToken
- The end delimiter character.- Returns:
- This builder instance for chaining.
-
validationMode
Sets the validation mode to control behavior when the provided variables do not match the variables required by the template. Default isValidationMode.THROW
.- Parameters:
validationMode
- The desired validation mode.- Returns:
- This builder instance for chaining.
-
validateStFunctions
Configures the renderer to support StringTemplate's built-in functions during validation.When enabled (set to true), identifiers in the template that match known ST function names (e.g., "first", "rest", "length") will not be treated as required input variables during validation.
When disabled (default, false), these identifiers are treated like regular variables and must be provided in the input map if validation is enabled (
ValidationMode.WARN
orValidationMode.THROW
).- Returns:
- This builder instance for chaining.
-
build
Builds and returns a newStTemplateRenderer
instance with the configured settings.- Returns:
- A configured
StTemplateRenderer
.
-