本文整理匯總了Java中org.apache.ibatis.plugin.Plugin類的典型用法代碼示例。如果您正苦於以下問題:Java Plugin類的具體用法?Java Plugin怎麽用?Java Plugin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Plugin類屬於org.apache.ibatis.plugin包,在下文中一共展示了Plugin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
/**
* 包裝目標類(Plugin.wrap(target, this),即,代理)
*
* @author songkun
* @create 2014年7月5日 下午2:47:10
* @since
* @param target
* @return Object
*/
@Override
public Object plugin(Object target) {
// 能夠走到這裏的target為以下幾種(可以推斷Signature注解該寫什麽):
// (1):org.apache.ibatis.executor.Executor(調用Configuration.newExecutor時,以下同)
// (2):org.apache.ibatis.executor.parameter.ParameterHandler(newParameterHandler)
// (3):org.apache.ibatis.executor.resultset.ResultSetHandler(newResultSetHandler)
// (4):org.apache.ibatis.executor.statement.StatementHandler(newStatementHandler)
// 當目標類是StatementHandler類型時,才可能包裝目標類,否者直接返回目標本身,減少目標被代理的次數
if (target instanceof StatementHandler) {
StatementHandler tmp = (StatementHandler) target;
// 如果是select 語句,則,包裝
// update/insert/delete……不包裝
// 也可以判斷sqlCommandType:target-->delegate-->mappedStatement-->sqlCommandType,delegate是私有屬性
if (tmp.getBoundSql() != null && this.startWithSelect(tmp.getBoundSql().getSql())) {
return Plugin.wrap(target, this);
}
}
return target;
}
示例2: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
public Object plugin(Object target) {
logger.debug("run mybatis plugin method");
Object obj = Plugin.wrap(target, this);
logger.debug("run mybatis plugin method end");
logger.debug(" plugin method return {}", obj.toString());
return obj;
}
示例3: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例4: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
// TODO Auto-generated method stub
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例5: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
// TODO Auto-generated method stub
if (target instanceof RoutingStatementHandler) {
return Plugin.wrap(target, this);
}
return target;
}
示例6: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
/**
* 隻攔截這兩種類型的 <br>
* StatementHandler <br>
* ResultSetHandler
*
* @param target
* @return
*/
@Override
public Object plugin(Object target) {
if (target instanceof StatementHandler || target instanceof ResultSetHandler) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例7: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例8: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例9: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
// 當目標類是StatementHandler類型時,才包裝目標類,否者直接返回目標本身,減少目標被代理的次數
if (target instanceof StatementHandler) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例10: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例11: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
/**
* 隻攔截Executor
*
* @param target
* @return
*/
/* @Override */
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例12: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
// TODO Auto-generated method stub
if (target instanceof StatementHandler) {
return Plugin.wrap(target, this);
} else {
return target;
}
}
示例13: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof StatementHandler) {
return Plugin.wrap(target, this);
}
return target;
}
示例14: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
}
if (target instanceof StatementHandler) {
return Plugin.wrap(target, this);
}
return target;
}
示例15: plugin
import org.apache.ibatis.plugin.Plugin; //導入依賴的package包/類
@Override
public Object plugin(Object target) {
if (target instanceof Executor) {
return Plugin.wrap(target, this);
}
return target;
}