Search in sources :

Example 1 with BoundSqlInterceptorChain

use of com.github.pagehelper.BoundSqlInterceptorChain in project Mybatis-PageHelper by pagehelper.

the class PageBoundSqlInterceptors method setProperties.

public void setProperties(Properties properties) {
    // 初始化 boundSqlInterceptorChain
    String boundSqlInterceptorStr = properties.getProperty("boundSqlInterceptors");
    if (StringUtil.isNotEmpty(boundSqlInterceptorStr)) {
        String[] boundSqlInterceptors = boundSqlInterceptorStr.split("[;|,]");
        List<BoundSqlInterceptor> list = new ArrayList<BoundSqlInterceptor>();
        for (int i = 0; i < boundSqlInterceptors.length; i++) {
            try {
                list.add((BoundSqlInterceptor) Class.forName(boundSqlInterceptors[i]).newInstance());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        if (list.size() > 0) {
            chain = new BoundSqlInterceptorChain(null, list);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) BoundSqlInterceptor(com.github.pagehelper.BoundSqlInterceptor) BoundSqlInterceptorChain(com.github.pagehelper.BoundSqlInterceptorChain)

Aggregations

BoundSqlInterceptor (com.github.pagehelper.BoundSqlInterceptor)1 BoundSqlInterceptorChain (com.github.pagehelper.BoundSqlInterceptorChain)1 ArrayList (java.util.ArrayList)1