package net.sourceforge.rtf.usecases.templateEngine;

import java.io.StringReader;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;

import net.sourceforge.rtf.ITemplateEngine;
import net.sourceforge.rtf.helper.RTFTemplateBuilder;

public class TestMapWithVelocity {

    public static void main(String[] args) throws Exception {
        RTFTemplateBuilder builder = RTFTemplateBuilder.newRTFTemplateBuilder();
        ITemplateEngine templateEngine = builder
                .newTemplateEngine(RTFTemplateBuilder.VELOCITY_ENGINE);
        Map values = new HashMap();
        values.put("getter","GETTER_VALUE");
        templateEngine.put("values" , values);
        
        StringReader reader = new StringReader("$values.getter");
        templateEngine.setTemplate(reader);
        
        StringWriter writer = new StringWriter();
        templateEngine.merge(writer);
        System.out.println(writer.getBuffer());
    }

}
