亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

最新版本mybatis中delegate已經改名為_flddelegate了 為什么還要使用delegate

我打開RoutingStatementHandler發現

private final StatementHandler _flddelegate;

所以我在老師用delegate的地方都使用的是_flddelegate 但是卻報錯 如果用delegate就不報錯?

不太理解 請大神指點

正在回答

2 回答

package org.apache.ibatis.executor.statement;


import java.sql.*;

import java.util.List;

import org.apache.ibatis.cursor.Cursor;

import org.apache.ibatis.executor.Executor;

import org.apache.ibatis.executor.ExecutorException;

import org.apache.ibatis.executor.parameter.ParameterHandler;

import org.apache.ibatis.mapping.*;

import org.apache.ibatis.session.ResultHandler;

import org.apache.ibatis.session.RowBounds;


// Referenced classes of package org.apache.ibatis.executor.statement:

// ? ? ? ? ? ?StatementHandler, SimpleStatementHandler, PreparedStatementHandler, CallableStatementHandler


public class RoutingStatementHandler

? ? implements StatementHandler

{


? ? public RoutingStatementHandler(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)

? ? {

? ? ? ? static class _cls1

? ? ? ? {


? ? ? ? ? ? static final int $SwitchMap$org$apache$ibatis$mapping$StatementType[];


? ? ? ? ? ? static?

? ? ? ? ? ? {

? ? ? ? ? ? ? ? $SwitchMap$org$apache$ibatis$mapping$StatementType = new int[StatementType.values().length];

? ? ? ? ? ? ? ? try

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? $SwitchMap$org$apache$ibatis$mapping$StatementType[StatementType.STATEMENT.ordinal()] = 1;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? catch(NoSuchFieldError nosuchfielderror) { }

? ? ? ? ? ? ? ? try

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? $SwitchMap$org$apache$ibatis$mapping$StatementType[StatementType.PREPARED.ordinal()] = 2;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? catch(NoSuchFieldError nosuchfielderror1) { }

? ? ? ? ? ? ? ? try

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? $SwitchMap$org$apache$ibatis$mapping$StatementType[StatementType.CALLABLE.ordinal()] = 3;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? catch(NoSuchFieldError nosuchfielderror2) { }

? ? ? ? ? ? }

? ? ? ? }


? ? ? ? switch(_cls1..SwitchMap.org.apache.ibatis.mapping.StatementType[ms.getStatementType().ordinal()])

? ? ? ? {

? ? ? ? case 1: // '\001'

? ? ? ? ? ? _flddelegate = new SimpleStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);

? ? ? ? ? ? break;


? ? ? ? case 2: // '\002'

? ? ? ? ? ? _flddelegate = new PreparedStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);

? ? ? ? ? ? break;


? ? ? ? case 3: // '\003'

? ? ? ? ? ? _flddelegate = new CallableStatementHandler(executor, ms, parameter, rowBounds, resultHandler, boundSql);

? ? ? ? ? ? break;


? ? ? ? default:

? ? ? ? ? ? throw new ExecutorException((new StringBuilder()).append("Unknown statement type: ").append(ms.getStatementType()).toString());

? ? ? ? }

? ? }


? ? public Statement prepare(Connection connection, Integer transactionTimeout)

? ? ? ? throws SQLException

? ? {

? ? ? ? return _flddelegate.prepare(connection, transactionTimeout);

? ? }


? ? public void parameterize(Statement statement)

? ? ? ? throws SQLException

? ? {

? ? ? ? _flddelegate.parameterize(statement);

? ? }


? ? public void batch(Statement statement)

? ? ? ? throws SQLException

? ? {

? ? ? ? _flddelegate.batch(statement);

? ? }


? ? public int update(Statement statement)

? ? ? ? throws SQLException

? ? {

? ? ? ? return _flddelegate.update(statement);

? ? }


? ? public List query(Statement statement, ResultHandler resultHandler)

? ? ? ? throws SQLException

? ? {

? ? ? ? return _flddelegate.query(statement, resultHandler);

? ? }


? ? public Cursor queryCursor(Statement statement)

? ? ? ? throws SQLException

? ? {

? ? ? ? return _flddelegate.queryCursor(statement);

? ? }


? ? public BoundSql getBoundSql()

? ? {

? ? ? ? return _flddelegate.getBoundSql();

? ? }


? ? public ParameterHandler getParameterHandler()

? ? {

? ? ? ? return _flddelegate.getParameterHandler();

? ? }


? ? private final StatementHandler _flddelegate;

}

而且名字在最后了

0 回復 有任何疑惑可以回復我~

我練習時使用的是3.4.1,該版本中還是delegate,不知道你說的新版是哪個版本?

public class RoutingStatementHandler implements StatementHandler {

? private final StatementHandler delegate;


0 回復 有任何疑惑可以回復我~
#1

Henizyang 提問者

我用的3.4.2 但的確他改名了啊= =
2017-03-02 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

最新版本mybatis中delegate已經改名為_flddelegate了 為什么還要使用delegate

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號