org.apache.ibatis.plugin.Signature类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(554)

本文整理了Java中org.apache.ibatis.plugin.Signature类的一些代码示例,展示了Signature类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Signature类的具体详情如下:
包路径:org.apache.ibatis.plugin.Signature
类名称:Signature

Signature介绍

暂无

代码示例

代码示例来源:origin: baomidou/mybatis-plus

@Data
@Accessors(chain = true)
@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
public class SqlExplainInterceptor extends AbstractSqlParserHandler implements Interceptor {

代码示例来源:origin: camunda/camunda-bpm-platform

private static Map<Class<?>, Set<Method>> getSignatureMap(Interceptor interceptor) {
 Intercepts interceptsAnnotation = interceptor.getClass().getAnnotation(Intercepts.class);
 // issue #251
 if (interceptsAnnotation == null) {
  throw new PluginException("No @Intercepts annotation was found in interceptor " + interceptor.getClass().getName());      
 }
 Signature[] sigs = interceptsAnnotation.value();
 Map<Class<?>, Set<Method>> signatureMap = new HashMap<Class<?>, Set<Method>>();
 for (Signature sig : sigs) {
  Set<Method> methods = signatureMap.get(sig.type());
  if (methods == null) {
   methods = new HashSet<Method>();
   signatureMap.put(sig.type(), methods);
  }
  try {
   Method method = sig.type().getMethod(sig.method(), sig.args());
   methods.add(method);
  } catch (NoSuchMethodException e) {
   throw new PluginException("Could not find method on " + sig.type() + " named " + sig.method() + ". Cause: " + e, e);
  }
 }
 return signatureMap;
}

代码示例来源:origin: baomidou/mybatis-plus

@Signature(type = StatementHandler.class, method = "query", args = {Statement.class, ResultHandler.class}),
  @Signature(type = StatementHandler.class, method = "update", args = {Statement.class}),
  @Signature(type = StatementHandler.class, method = "batch", args = {Statement.class})
})
public class PerformanceInterceptor implements Interceptor {

代码示例来源:origin: org.mybatis/mybatis

private static Map<Class<?>, Set<Method>> getSignatureMap(Interceptor interceptor) {
 Intercepts interceptsAnnotation = interceptor.getClass().getAnnotation(Intercepts.class);
 // issue #251
 if (interceptsAnnotation == null) {
  throw new PluginException("No @Intercepts annotation was found in interceptor " + interceptor.getClass().getName());
 }
 Signature[] sigs = interceptsAnnotation.value();
 Map<Class<?>, Set<Method>> signatureMap = new HashMap<>();
 for (Signature sig : sigs) {
  Set<Method> methods = signatureMap.computeIfAbsent(sig.type(), k -> new HashSet<>());
  try {
   Method method = sig.type().getMethod(sig.method(), sig.args());
   methods.add(method);
  } catch (NoSuchMethodException e) {
   throw new PluginException("Could not find method on " + sig.type() + " named " + sig.method() + ". Cause: " + e, e);
  }
 }
 return signatureMap;
}

代码示例来源:origin: a466350665/smart

@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }),
    @Signature(type = ResultSetHandler.class, method = "handleResultSets", args = { Statement.class }) })
public class PaginationInterceptor implements Interceptor {

代码示例来源:origin: org.apache.ibatis/ibatis-core

private static Map<Class, Set<Method>> getSignatureMap(Interceptor interceptor) {
 Signature[] sigs = interceptor.getClass().getAnnotation(Intercepts.class).value();
 Map<Class, Set<Method>> signatureMap = new HashMap<Class, Set<Method>>();
 for (Signature sig : sigs) {
  Set<Method> methods = signatureMap.get(sig.type());
  if (methods == null) {
   methods = new HashSet<Method>();
   signatureMap.put(sig.type(), methods);
  }
  try {
   Method method = sig.type().getMethod(sig.method(), sig.args());
   methods.add(method);
  } catch (NoSuchMethodException e) {
   throw new PluginException("Could not find method on " + sig.type() + " named " + sig.method() + ". Cause: " + e, e);
  }
 }
 return signatureMap;
}

代码示例来源:origin: baomidou/mybatis-plus

@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
public class OptimisticLockerInterceptor implements Interceptor {

代码示例来源:origin: baomidou/mybatis-plus

@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
public class IllegalSQLInterceptor implements Interceptor {

代码示例来源:origin: xianrendzw/EasyReport

@Signature(
  type = Executor.class,
  method = "update",
  args = {MappedStatement.class, Object.class}),
@Signature(
  type = Executor.class,
  method = "query",

代码示例来源:origin: zhangxd1989/springboot-dubbox

@Signature(type = Executor.class, method = "update", args = {
  MappedStatement.class, Object.class}),
@Signature(type = Executor.class, method = "query", args = {
  MappedStatement.class, Object.class, RowBounds.class,
  ResultHandler.class})})

代码示例来源:origin: mybatis-book/book

@Signature(type = ResultSetHandler.class, method = "handleResultSets", args = {Statement.class})

代码示例来源:origin: mybatis-book/book

@Intercepts({
  @Signature(type = Executor.class, method = "query", args = {
      MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class
  })

代码示例来源:origin: Meituan-Dianping/Zebra

@Intercepts(@Signature(type = Executor.class, method = "query", args = { MappedStatement.class, Object.class,
    RowBounds.class, ResultHandler.class }))
public class PageInterceptor implements Interceptor {

代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-web

/**
 * 权限控制切面处理的默认实现类
 *
 * @author zhaohuihua
 * @version 170612
 */
@Intercepts({
    @Signature(type = Executor.class, method = "query",
      args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class }),
    @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
public class DataIsolationChooseImpl extends DataIsolationChooseControlling {

  public DataIsolationChooseImpl() {
  }

}

代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-web

/**
 * 操作轨迹记录, 查找带有@OperateTraces的参数对象, 提取操作日志信息
 *
 * @author zhaohuihua
 * @version 170615
 */
@Intercepts({
    @Signature(type = Executor.class, method = "query",
      args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class }),
    @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
public class OperateTracesSimpleImpl extends OperateTracesControlling {

  public OperateTracesSimpleImpl(IControllingVars vars) {
    super(vars);
  }

}

代码示例来源:origin: org.flowable/flowable-engine-common

@Signature(type = Executor.class, method = "query",
        args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class }),
    @Signature(type = Executor.class, method = "query",
        args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class }),
    @Signature(type= Executor.class, method = "update", args = { MappedStatement.class, Object.class})
})
public class LogSqlExecutionTimePlugin implements Interceptor {

代码示例来源:origin: Yirendai/cicada

@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
  @Signature(type = Executor.class, method = "query",
    args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class})})
public class MybatisInterceptor implements Interceptor {

 public Object intercept(final Invocation invocation) throws Throwable {
  final MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
  Object returnValue = null;
  final long start = System.currentTimeMillis();
  returnValue = invocation.proceed();
  final long end = System.currentTimeMillis();

  final String sqlId = mappedStatement.getId();
  final int lastIndex = sqlId.lastIndexOf('.');
  final String className = sqlId.substring(0, lastIndex);
  final String methodName = sqlId.substring(lastIndex + 1);
  Tracer.getInstance().addBinaryAnnotation(className, methodName, (int) (end - start));

  return returnValue;
 }

 public Object plugin(final Object target) {
  return Plugin.wrap(target, this);
 }

 public void setProperties(final Properties properties0) {
  //do nothing
 }
}

代码示例来源:origin: zhuzhengquan/pc5s

@Intercepts({ 
  @Signature(type = Executor.class, method = "query", args = { MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
  @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class}) })
public class QueryClauseInterceptor implements Interceptor {
  Logger logger = LoggerFactory.getLogger(this.getClass());

代码示例来源:origin: io.github.itfinally/mybatis-paging

/**
 * <pre>
 * *********************************************
 * All rights reserved.
 * Description: ${类文件描述}
 * *********************************************
 *  Version       Date          Author        Desc ( 一句话描述修改 )
 *  v1.0          2018/8/17       itfinally       首次创建
 * *********************************************
 * </pre>
 */
@Component
@SuppressWarnings( "unchecked" )
@Intercepts( @Signature( type = Executor.class, method = "query", args = { MappedStatement.class, Object.class,
    RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class } ) )
public class CacheQueryInterceptor extends AbstractPagingInterceptor {

  public CacheQueryInterceptor( MybatisPagingProperties properties ) {
    super( properties );
  }

  @Override
  protected void hook( Object[] thisArgs, MappedStatement mappedStatement, BoundSql boundSql ) {
    thisArgs[ 0 ] = mappedStatement;
    thisArgs[ 5 ] = boundSql;
  }
}

代码示例来源:origin: limeng32/mybatis.flying

@Intercepts(value = {
    @Signature(args = { MappedStatement.class, Object.class, RowBounds.class,
        ResultHandler.class }, method = "query", type = Executor.class),
    @Signature(args = { MappedStatement.class, Object.class }, method = "update", type = Executor.class),
    @Signature(args = { boolean.class }, method = "commit", type = Executor.class),
    @Signature(args = { boolean.class }, method = "rollback", type = Executor.class),
    @Signature(args = { boolean.class }, method = "close", type = Executor.class) })
public class EnhancedCachingInterceptor implements Interceptor {
  private CacheKeysPool queryCacheOnCommit = new CacheKeysPool();

相关文章