docs: add Javadoc
parent
7f632d2b6e
commit
8dd547404d
|
@ -9,6 +9,14 @@ import org.apache.velocity.tools.ToolManager;
|
|||
import org.apache.velocity.util.StringBuilderWriter;
|
||||
|
||||
// FIXME doc, tests
|
||||
|
||||
/**
|
||||
* This class aims to generate localized messages or strings either merging Velocity templates or
|
||||
* taking directly the keys from {@link java.util.ResourceBundle}
|
||||
*
|
||||
* @author Davide Polonio
|
||||
* @since 1.0
|
||||
*/
|
||||
public class TemplateContentGenerator {
|
||||
|
||||
private final LocalizedMessageFactory localizedMessageFactory;
|
||||
|
@ -18,6 +26,19 @@ public class TemplateContentGenerator {
|
|||
this.localizedMessageFactory = localizedMessageFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a Velocity template located in the local Jar resource path with the given {@link Locale},
|
||||
* provided as a {@link String}. A {@link Consumer} is provided in order to let the user customize
|
||||
* the {@link VelocityContext} with additional variables. Localization strings will be directly
|
||||
* taken via the use of {@link LocalizedTool} class.
|
||||
*
|
||||
* @param velocityContextConsumer a lambda function that allows for the customization of {@link
|
||||
* VelocityContext} instance
|
||||
* @param localeAsString a {@link Locale} formatted as a {@link String}. Note that {@link
|
||||
* Locale#forLanguageTag(String)} will be used for the conversion
|
||||
* @param templateName the path to the local Jar resource
|
||||
* @return a {@link String} containing the localized message
|
||||
*/
|
||||
public String mergeTemplate(
|
||||
Consumer<VelocityContext> velocityContextConsumer,
|
||||
String localeAsString,
|
||||
|
|
Loading…
Reference in New Issue