org.apache.ibatis.plugin.Signature.method()方法的使用及代码示例

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

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

Signature.method介绍

暂无

代码示例

代码示例来源: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: 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: 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;
}

相关文章