All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.tenio.interstellar.dao.mybatis.FreeMarkerSqlTemplate Maven / Gradle / Ivy

The newest version!
package org.tenio.interstellar.dao.mybatis;

import freemarker.template.Configuration;
import freemarker.template.Template;

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

/**
 * TODO
 * 

* @author: Ban Tenio * @version: 1.0 */ public class FreeMarkerSqlTemplate implements SqlTemplate { private final Configuration cfg; /** * * TODO * * @param cfg TODO */ public FreeMarkerSqlTemplate(Configuration cfg) { this.cfg = cfg; } @Override public String executeSqlTemplate(String templateFlag, Map params) { try { Template template = cfg.getTemplate(templateFlag); StringWriter out = new StringWriter(); template.process(params, out); return out.toString(); } catch (Exception e) { throw new RuntimeException("generated the flag '" + templateFlag + "' sql occurred error.", e); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy