public class StringTemplateContentHandlerFactory extends Object implements org.smooks.api.delivery.ContentHandlerFactory
org.smooks.api.resource.visitor.dom.DOMElementVisitor Creator class.
Creates org.smooks.api.resource.visitor.dom.DOMElementVisitor instances for applying
StringTemplate transformations (i.e. ".st" files).
This templating solution relies on the Smooks JavaBean Cartridge
to perform the JavaBean population that's required by StringTemplate.
<resource-config selector="target-element">
<!-- See URIResourceLocator -->
<resource>/com/acme/AcmeStringTemplate.st</resource>
<!-- (Optional) The action to be applied on the template content. Should the content
generated by the template:
1. replace ("REPLACE") the target element, or
2. be added to ("ADD_TO") the target element, or
3. be inserted before ("INSERT_BEFORE") the target element, or
4. be inserted after ("INSERT_AFTER") the target element.
5. be bound to ("BIND_TO") a BeanContext variable named by the "bindId" param.
Default "replace".-->
<param name="action">REPLACE/ADD_TO/INSERT_BEFORE/INSERT_AFTER</param>
<!-- (Optional) Should the template be applied before (true) or
after (false) Smooks visits the child elements of the target element.
Default "false".-->
<param name="applyTemplateBefore">true/false</param>
<!-- (Optional) The name of the OutputStreamResource
to which the result should be written. If set, the "action" param is ignored. -->
<param name="outputStreamResource">xyzResource</param>
<!-- (Optional) Template encoding.
Default "UTF-8".-->
<param name="encoding">encoding</param>
<!-- (Optional) bindId when "action" is "BIND_TO".
<param name="bindId">xxxx</param>
</resource-config>
| Constructor and Description |
|---|
StringTemplateContentHandlerFactory() |
| Modifier and Type | Method and Description |
|---|---|
org.smooks.api.delivery.ContentHandler |
create(org.smooks.api.resource.config.ResourceConfig resourceConfig)
Create a StringTemplate based ContentHandler.
|
String |
getType() |
public org.smooks.api.delivery.ContentHandler create(org.smooks.api.resource.config.ResourceConfig resourceConfig)
throws org.smooks.api.SmooksConfigException
create in interface org.smooks.api.delivery.ContentHandlerFactoryresourceConfig - The SmooksResourceConfiguration for the StringTemplate.ContentHandler instance.org.smooks.api.SmooksConfigExceptionpublic String getType()
getType in interface org.smooks.api.delivery.ContentHandlerFactoryCopyright © 2024. All rights reserved.