Class FreeMarkerSqlTpl
java.lang.Object
org.nutz.dao.impl.sql.NutStatement
org.nutz.dao.impl.sql.NutSql
tech.riemann.nif.nutz.dao.sqltpl.NutSqlTpl
tech.riemann.nif.nutz.dao.sqltpl.freemarker.FreeMarkerSqlTpl
- All Implemented Interfaces:
Serializable, org.nutz.dao.sql.DaoStatement, org.nutz.dao.sql.Sql
基于FreeMarker模板引擎的SQL模板实现类 该类继承自NutSqlTpl,用于处理使用FreeMarker语法编写的SQL模板
- Author:
- Kerbores(kerbores@gmail.com)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static freemarker.template.Configuration自定义ConfigurationFields inherited from class NutSqlTpl
renderCompleteFields inherited from class org.nutz.dao.impl.sql.NutSql
callback, customValueAdaptor, items, paramIndex, params, placeholder, rows, sourceSql, varIndex, varsFields inherited from class org.nutz.dao.impl.sql.NutStatement
expert -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.nutz.dao.sql.Sqlc(org.nutz.dao.sql.Sql sql) 渲染一个Sql对象,使用FreeMarker模板引擎处理SQL模板 将SQL模板中的变量替换为实际值static freemarker.template.Configurationcfg()获取Configuration配置对象 如果没有自定义的Configuration,则创建一个默认配置protected voidrender()执行SQL模板渲染操作 调用c方法完成实际的模板渲染工作static voidsetConfiguration(freemarker.template.Configuration cfg) 设置自定义Configuration配置对象Methods inherited from class NutSqlTpl
checkRender, getAdaptors, getParamMatrix, toPreparedStatementMethods inherited from class org.nutz.dao.impl.sql.NutSql
_params_count, addBatch, appendSourceSql, changePlaceholder, clearBatch, duplicate, getOutParams, getSourceSql, literal, onAfter, onBefore, paramIndex, params, setCallback, setCondition, setEntity, setPager, setParam, setParams, setSourceSql, setValueAdaptor, setVar, setVars, varIndex, varsMethods inherited from class org.nutz.dao.impl.sql.NutStatement
forceExecQuery, forPrint, getAdapterBy, getBoolean, getContext, getDouble, getDouble, getEntity, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getNumber, getObject, getResult, getSqlType, getString, getUpdateCount, isAlter, isCall, isCreate, isDelete, isDrop, isExec, isForceExecQuery, isInsert, isOther, isRun, isSelect, isUpdate, param2String, setContext, setExpert, setQueryTimeout, setSqlType, toExampleStatement, toStatement, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.nutz.dao.sql.DaoStatement
forceExecQuery, forPrint, getBoolean, getContext, getDouble, getDouble, getEntity, getFloat, getFloat, getInt, getInt, getList, getLong, getLong, getNumber, getObject, getResult, getSqlType, getString, getUpdateCount, isAlter, isCall, isCreate, isDelete, isDrop, isExec, isForceExecQuery, isInsert, isOther, isRun, isSelect, isUpdate, setExpert, setQueryTimeout, toString
-
Field Details
-
cfg
protected static volatile freemarker.template.Configuration cfg自定义Configuration低级: volatile——防止多线程下未初始化读
-
-
Constructor Details
-
FreeMarkerSqlTpl
-
-
Method Details
-
c
public static org.nutz.dao.sql.Sql c(org.nutz.dao.sql.Sql sql) 渲染一个Sql对象,使用FreeMarker模板引擎处理SQL模板 将SQL模板中的变量替换为实际值- Parameters:
sql- 需要渲染的Sql实例- Returns:
- 原对象,用于链式调用
-
cfg
public static freemarker.template.Configuration cfg()获取Configuration配置对象 如果没有自定义的Configuration,则创建一个默认配置- Returns:
- Configuration实例
-
setConfiguration
public static void setConfiguration(freemarker.template.Configuration cfg) 设置自定义Configuration配置对象- Parameters:
cfg- 自定义Configuration实例
-
render
-