Package io.jmix.messagetemplates
Interface MessageTemplatesGenerator.SingleTemplateGenerator
- All Known Implementing Classes:
MessageTemplatesGeneratorImpl.SingleTemplateGeneratorImpl
- Enclosing interface:
- MessageTemplatesGenerator
public static interface MessageTemplatesGenerator.SingleTemplateGenerator
The generator is used to create messages based on a single template and a single map of parameters.
The result of the generation is a template filled with passed parameters.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a parameter to filling the template.generate()
Generates a message based on the current state of the generator.withConfiguration
(freemarker.template.Configuration configuration) Sets theConfiguration
for message generation.withParams
(Map<String, Object> params) Sets the parameters for filling the template.withTemplate
(MessageTemplate template) Sets the template for generating the message.withTemplateCode
(String templateCode) Sets the template code for generating the message.
-
Method Details
-
withTemplate
Sets the template for generating the message.- Parameters:
template
- template for generating the message- Returns:
- this
-
withTemplateCode
Sets the template code for generating the message.- Parameters:
templateCode
- template code for generating the message- Returns:
- this
-
withConfiguration
MessageTemplatesGenerator.SingleTemplateGenerator withConfiguration(freemarker.template.Configuration configuration) Sets theConfiguration
for message generation.- Parameters:
configuration
- configuration for generating the message- Returns:
- this
-
withParams
Sets the parameters for filling the template.- Parameters:
params
- parameters map- Returns:
- this
-
addParam
Adds a parameter to filling the template.- Parameters:
alias
- parameter aliasvalue
- parameter value- Returns:
- this
-
generate
String generate()Generates a message based on the current state of the generator.- Returns:
- generated message as a string
-