== templates
:idprefix: id_ 
This addon provides *standalone* functionality, and *exports services* for use in other addons. The templates addon allows a template to be processed by replacing the variables with the provided parameters   
        
=== Depends on
[options="header"]
|===
|Addon |Exported |Optional
|resources
|yes
|no
|===

== Setup
This Addon requires the following installation steps.
=== Add configuration to pom.xml 
To use this addon, you must add it as a dependency in the *pom.xml* of your `forge-addon` classified artifact:
(Make sure the dependency is put all the way to the left, and uses 3 spaces for indentation of GAV)
[source,xml]
----
<dependency>
   <groupId>org.jboss.forge.adon.templates</groupId>
   <artifactId>templates</artifactId>
   <classifier>forge-addon</classifier>
   <version>${version}</version>
</dependency>
----
== Features
TemplateProcessorFactory for template processing:: 
Allows a template to be processed by replacing the variables with the provided parameters 
+
[source,java]
----
@Inject private TemplateProcessorFactory factory;
...
FileResource<?> resource = ...; // A file resource containing "Hello ${name}"
TemplateProcessor processor = factory.fromTemplate(resource);
Map<String,Object> params = new HashMap<String,Object>(); //Could be a POJO also.
params.put("name", "JBoss Forge");
String output = processor.process(params); // should return "Hello JBoss Forge". 
----
+
[TIP] 
====
If your addon uses a container that does not support "@Inject" annotations, services such as the `TemplateProcessorFactory` may also be 
accessed via the `AddonRegistry`:
----
Imported<TemplateProcessorFactory> imported = addonRegistry.getServices(TemplateProcessorFactory.class);
TemplateProcessorFactory factory = imported.get();
----
==== 
