public class DaoInterceptorChain extends Object implements ConnCallback
DaoLogInterceptor
,
DaoTimeInterceptor
限定符和类型 | 字段和说明 |
---|---|
protected int |
autoTransLevel |
protected Connection |
connection |
protected int |
current |
protected DaoStatement |
daoStatement |
protected DaoExecutor |
executor |
protected String |
id |
protected List<DaoInterceptor> |
interceptors |
protected DaoStatement[] |
sts |
protected int |
updateCount |
构造器和说明 |
---|
DaoInterceptorChain(DaoStatement... sts)
新建一个DaoInterceptorChain.
|
限定符和类型 | 方法和说明 |
---|---|
DaoInterceptorChain |
doChain()
继续下一个拦截器,如果已经是最后一个拦截器,那么执行executor.exec
|
int |
getAutoTransLevel()
获取当前自动事务级别,DaoRunner中使用强制事务时会使用之.拦截器不能修改,即使修改也不会生效
|
Connection |
getConnection()
获取当前数据库连接
|
DaoStatement |
getDaoStatement()
当前执行的DaoStatement
|
DaoStatement[] |
getDaoStatements()
全部DaoStatement,可能不止一条
|
String |
getId()
拦截器链的id, 为一个uu32识别符.
|
List<DaoInterceptor> |
getInterceptors()
拦截器列表(暂不开放修改)
|
SqlContext |
getSqlContext()
获取当前DaoStatement的上下文,注意,一个拦截器链可能包含多个DaoStatement
|
int |
getUpdateCount()
更新总数,用于DaoSupport(NutDao)获取更新总数.
|
boolean |
hasNext()
是否还有下一个拦截器
|
void |
invoke(Connection conn)
这是DaoExecutor会执行的方法,拦截器内不要执行这个方法!!
|
DaoInterceptor |
next()
获取下一个拦截器.
|
void |
setAutoTransLevel(int autoTransLevel)
设置强制事务的级别,对拦截器来说无意义.
|
void |
setConnection(Connection connection)
设置当前使用的数据库连接
|
void |
setCurrent(int current)
设置当前拦截器索引.
|
void |
setExecutor(DaoExecutor executor)
设置DaoExecutor.
|
void |
setInterceptors(List<DaoInterceptor> interceptors)
设置新的拦截器列表.
|
protected int autoTransLevel
protected Connection connection
protected int current
protected DaoStatement daoStatement
protected DaoExecutor executor
protected List<DaoInterceptor> interceptors
protected int updateCount
protected DaoStatement[] sts
protected String id
public DaoInterceptorChain(DaoStatement... sts)
sts
- 将要进行的Dao操作(不一定是SQL操作,有可能是EL)public DaoInterceptorChain doChain() throws DaoException
Exception
DaoException
public int getAutoTransLevel()
public DaoStatement getDaoStatement()
public DaoStatement[] getDaoStatements()
public List<DaoInterceptor> getInterceptors()
public int getUpdateCount()
public boolean hasNext()
public void invoke(Connection conn) throws Exception
invoke
在接口中 ConnCallback
Exception
public DaoInterceptor next()
public void setAutoTransLevel(int autoTransLevel)
autoTransLevel
- 与DaoSupport(NutDao)内的值一致public void setCurrent(int current)
current
- public void setExecutor(DaoExecutor executor)
executor
- 新的DaoExecutor,不可以是nullpublic void setInterceptors(List<DaoInterceptor> interceptors)
interceptors
- 新的拦截器列表public void setConnection(Connection connection)
connection
- 新的数据库连接,不可以是nullpublic Connection getConnection()
public SqlContext getSqlContext()
public String getId()
Copyright © 2017. All rights reserved.