【Mybatis源码】ResolverUtil类

ResolverUtil类在Mybatis中广泛使用,主要用于查询包下匹配的类

一、ResolverUtil.Test

在ResolverUtil中定义了一个内部接口Test,具体如下:

public class ResolverUtil {
  /**
   * A simple interface that specifies how to test classes to determine if they
   * are to be included in the results produced by the ResolverUtil.
   */
  public interface Test {
    /**
     * Will be called repeatedly with candidate classes. Must return True if a class
     * is to be included in the results, false otherwise.
     */
    boolean matches(Class type);
  }
}

此接口只包含了一个方法,此方法主要用于测试类(type)是否匹配,当类匹配时返回true,当类不匹配时返回false。

另外ResolverUtil类也提供了Test接口的两个实现:IsA、AnnotatedWith

你可能感兴趣的:(Mybatis源码,mybatis,java)