com.beetl.sql.rewrite.mapper.RewriteMapperBuilder Maven / Gradle / Ivy
The newest version!
package com.beetl.sql.rewrite.mapper;
import com.beetl.sql.rewrite.SqlRewriteInterceptor;
import org.beetl.sql.clazz.kit.BeanKit;
import org.beetl.sql.clazz.kit.ClassLoaderKit;
import org.beetl.sql.mapper.DefaultMapperBuilder;
import java.lang.reflect.Proxy;
public class RewriteMapperBuilder extends DefaultMapperBuilder {
SqlRewriteInterceptor sqlRewriteInterceptor;
public RewriteMapperBuilder(SqlRewriteInterceptor sqlRewriteInterceptor){
this.sqlRewriteInterceptor = sqlRewriteInterceptor;
}
@Override
public T buildInstance(Class mapperInterface) {
ClassLoaderKit loader = sqlManager.getClassLoaderKit();
if (BeanKit.queryLambdasSupport) {
return (T) Proxy.newProxyInstance(loader.getPreferredLoader(), new Class>[]{mapperInterface},
new RewriteMapperJava8Proxy(mapperConfig, sqlManager, mapperInterface,sqlRewriteInterceptor));
} else {
throw new UnsupportedOperationException("不支持Jdk8一下版本");
}
}
}