[
https://issues.apache.org/jira/browse/FREEMARKER-74?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16180607#comment-16180607
]
Jörg Rade commented on FREEMARKER-74:
-------------------------------------
Hi Daniel,
thanks for your prompt response!
Adding javadoc would sure help. For my (very limited UseCase) another
convenience Constructor "Template(String sourceCode)" would make sense.
Currently my code looks like: {code}
public void fill() {
MessageModel mm = new MessageModel(this.configuration);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
Template t = new Template("dontCare", this.body, null);
Writer out = new OutputStreamWriter(baos);
t.process(mm, out);
} catch (freemarker.template.TemplateException | IOException e) {
messageService.raiseError("Error while processing " + type);
}
setBody(baos.toString());
}
{code}
And it does it's job.
Thanks for your work! -j
> Constructors freemarker.template.Template
> -----------------------------------------
>
> Key: FREEMARKER-74
> URL: https://issues.apache.org/jira/browse/FREEMARKER-74
> Project: Apache Freemarker
> Issue Type: Improvement
> Reporter: Jörg Rade
>
> # add java doc to all Constructors
> # change 'String name' to 'String templateDescription'
> # provide a Constructor where the 'templateSourceString' can be passed in
> directly
> ad 3) I have a use case where I have already have the template source at hand
> and all the file io is handled elsewhere - so I may even get along without
> cfg (insofar as it deals with file io)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)