Input - Skill input type.Output - Skill output type.public class BaseTemplateFactory<Input,Output> extends Object implements TemplateFactory<Input,Output>
TemplateFactory implementation to chain TemplateLoader and TemplateRenderer.
It is responsible to pass in template name, data map and Input to get response output for skill request.| Modifier and Type | Class and Description |
|---|---|
static class |
BaseTemplateFactory.Builder<Input,Output,Self extends BaseTemplateFactory.Builder<Input,Output,Self>>
Base Template Factory Builder.
|
| Modifier and Type | Field and Description |
|---|---|
protected List<TemplateLoader<Input>> |
templateLoaders
List of loader interfaces for template loading from data store.
|
protected TemplateRenderer<Output> |
templateRenderer
Renderer interface for template rendering and response conversion.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseTemplateFactory(List<TemplateLoader<Input>> templateLoaders,
TemplateRenderer<Output> templateRenderer)
Constructor to build an instance of BaseTemplateFactory.
|
| Modifier and Type | Method and Description |
|---|---|
static <Input,Output> |
builder()
Return Builder instance.
|
static <Input,Output,Self extends BaseTemplateFactory.Builder<Input,Output,Self>> |
forTypes(Class<Input> input,
Class<Output> output)
Return Builder instance.
|
Output |
processTemplate(String responseTemplateName,
Map<String,Object> dataMap,
Input input)
Process response template and data to generate skill response.
|
protected final List<TemplateLoader<Input>> templateLoaders
protected final TemplateRenderer<Output> templateRenderer
protected BaseTemplateFactory(List<TemplateLoader<Input>> templateLoaders, TemplateRenderer<Output> templateRenderer)
templateLoaders - template loaders.templateRenderer - template renderer.public static <Input,Output,Self extends BaseTemplateFactory.Builder<Input,Output,Self>> BaseTemplateFactory.Builder<Input,Output,Self> forTypes(Class<Input> input, Class<Output> output)
Input - Skill input type.Output - Skill output type.Self - of type Builder class or any parent class of Builder.input - class of type input.output - class of type output.BaseTemplateFactory.Builder.public static <Input,Output> BaseTemplateFactory.Builder<Input,Output,?> builder()
Input - Skill input type.Output - Skill output type.BaseTemplateFactory.Builder.public Output processTemplate(String responseTemplateName, Map<String,Object> dataMap, Input input) throws TemplateFactoryException
processTemplate in interface TemplateFactory<Input,Output>responseTemplateName - template namedataMap - map that contains template injecting datainput - skill request inputTemplateFactoryException - if fail to process templateCopyright © 2023. All rights reserved.