miemie 6 роки тому
батько
коміт
dc5ff86a84

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/MybatisMapperRegistry.java

@@ -15,7 +15,7 @@
  */
 package com.baomidou.mybatisplus.core;
 
-import com.baomidou.mybatisplus.core.override.PageMapperProxyFactory;
+import com.baomidou.mybatisplus.core.override.MybatisMapperProxyFactory;
 import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils;
 import org.apache.ibatis.binding.BindingException;
 import org.apache.ibatis.binding.MapperRegistry;
@@ -37,7 +37,7 @@ import java.util.Map;
  */
 public class MybatisMapperRegistry extends MapperRegistry {
 
-    private final Map<Class<?>, PageMapperProxyFactory<?>> knownMappers = new HashMap<>();
+    private final Map<Class<?>, MybatisMapperProxyFactory<?>> knownMappers = new HashMap<>();
     private final Configuration config;
 
     public MybatisMapperRegistry(Configuration config) {
@@ -50,7 +50,7 @@ public class MybatisMapperRegistry extends MapperRegistry {
     @SuppressWarnings("unchecked")
     @Override
     public <T> T getMapper(Class<T> type, SqlSession sqlSession) {
-        final PageMapperProxyFactory<T> mapperProxyFactory = (PageMapperProxyFactory<T>) knownMappers.get(type);
+        final MybatisMapperProxyFactory<T> mapperProxyFactory = (MybatisMapperProxyFactory<T>) knownMappers.get(type);
         if (mapperProxyFactory == null) {
             throw new BindingException("Type " + type + " is not known to the MybatisPlusMapperRegistry.");
         }
@@ -77,7 +77,7 @@ public class MybatisMapperRegistry extends MapperRegistry {
             }
             boolean loadCompleted = false;
             try {
-                knownMappers.put(type, new PageMapperProxyFactory<>(type));
+                knownMappers.put(type, new MybatisMapperProxyFactory<>(type));
                 // It's important that the type is added before the parser is run
                 // otherwise the binding may automatically be attempted by the
                 // mapper parser. If the type is already known, it won't try.

+ 2 - 2
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/PageMapperMethod.java → mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/MybatisMapperMethod.java

@@ -48,11 +48,11 @@ import java.util.Optional;
  * @author miemie
  * @since 2018-06-09
  */
-public class PageMapperMethod {
+public class MybatisMapperMethod {
     private final SqlCommand command;
     private final MethodSignature method;
 
-    public PageMapperMethod(Class<?> mapperInterface, Method method, Configuration config) {
+    public MybatisMapperMethod(Class<?> mapperInterface, Method method, Configuration config) {
         this.command = new SqlCommand(config, mapperInterface, method);
         this.method = new MethodSignature(config, mapperInterface, method);
     }

+ 6 - 6
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/PageMapperProxy.java → mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/MybatisMapperProxy.java

@@ -35,14 +35,14 @@ import java.util.Map;
  * @author miemie
  * @since 2018-06-09
  */
-public class PageMapperProxy<T> implements InvocationHandler, Serializable {
+public class MybatisMapperProxy<T> implements InvocationHandler, Serializable {
 
     private static final long serialVersionUID = -6424540398559729838L;
     private final SqlSession sqlSession;
     private final Class<T> mapperInterface;
-    private final Map<Method, PageMapperMethod> methodCache;
+    private final Map<Method, MybatisMapperMethod> methodCache;
 
-    public PageMapperProxy(SqlSession sqlSession, Class<T> mapperInterface, Map<Method, PageMapperMethod> methodCache) {
+    public MybatisMapperProxy(SqlSession sqlSession, Class<T> mapperInterface, Map<Method, MybatisMapperMethod> methodCache) {
         this.sqlSession = sqlSession;
         this.mapperInterface = mapperInterface;
         this.methodCache = methodCache;
@@ -59,12 +59,12 @@ public class PageMapperProxy<T> implements InvocationHandler, Serializable {
         } catch (Throwable t) {
             throw ExceptionUtil.unwrapThrowable(t);
         }
-        final PageMapperMethod mapperMethod = cachedMapperMethod(method);
+        final MybatisMapperMethod mapperMethod = cachedMapperMethod(method);
         return mapperMethod.execute(sqlSession, args);
     }
 
-    private PageMapperMethod cachedMapperMethod(Method method) {
-        return methodCache.computeIfAbsent(method, k -> new PageMapperMethod(mapperInterface, method, sqlSession.getConfiguration()));
+    private MybatisMapperMethod cachedMapperMethod(Method method) {
+        return methodCache.computeIfAbsent(method, k -> new MybatisMapperMethod(mapperInterface, method, sqlSession.getConfiguration()));
     }
 
     private Object invokeDefaultMethod(Object proxy, Method method, Object[] args)

+ 6 - 6
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/PageMapperProxyFactory.java → mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/override/MybatisMapperProxyFactory.java

@@ -31,12 +31,12 @@ import java.util.concurrent.ConcurrentHashMap;
  * @author miemie
  * @since 2018-06-09
  */
-public class PageMapperProxyFactory<T> {
+public class MybatisMapperProxyFactory<T> {
 
     private final Class<T> mapperInterface;
-    private final Map<Method, PageMapperMethod> methodCache = new ConcurrentHashMap<>();
+    private final Map<Method, MybatisMapperMethod> methodCache = new ConcurrentHashMap<>();
 
-    public PageMapperProxyFactory(Class<T> mapperInterface) {
+    public MybatisMapperProxyFactory(Class<T> mapperInterface) {
         this.mapperInterface = mapperInterface;
     }
 
@@ -44,17 +44,17 @@ public class PageMapperProxyFactory<T> {
         return mapperInterface;
     }
 
-    public Map<Method, PageMapperMethod> getMethodCache() {
+    public Map<Method, MybatisMapperMethod> getMethodCache() {
         return methodCache;
     }
 
     @SuppressWarnings("unchecked")
-    protected T newInstance(PageMapperProxy<T> mapperProxy) {
+    protected T newInstance(MybatisMapperProxy<T> mapperProxy) {
         return (T) Proxy.newProxyInstance(mapperInterface.getClassLoader(), new Class[]{mapperInterface}, mapperProxy);
     }
 
     public T newInstance(SqlSession sqlSession) {
-        final PageMapperProxy<T> mapperProxy = new PageMapperProxy<>(sqlSession, mapperInterface, methodCache);
+        final MybatisMapperProxy<T> mapperProxy = new MybatisMapperProxy<>(sqlSession, mapperInterface, methodCache);
         return newInstance(mapperProxy);
     }
 }