java.lang.reflect.Method.getAnnotatedExceptionTypes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(138)

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

Method.getAnnotatedExceptionTypes介绍

暂无

代码示例

代码示例来源:origin: Diorite/Diorite

/**
 * Returns an array of {@code AnnotatedType} objects that represent the use
 * of types to specify the declared exceptions of the method/constructor
 * represented by this Executable. The order of the objects in the array
 * corresponds to the order of the exception types in the declaration of
 * the method/constructor.
 *
 * Returns an array of length 0 if the method/constructor declares no
 * exceptions.
 *
 * @return an array of objects representing the declared exceptions of the method or constructor represented by this {@code Executable}
 */
public AnnotatedType[] getAnnotatedExceptionTypes()
{
  return this.method.getAnnotatedExceptionTypes();
}

代码示例来源:origin: org.osgi/osgi.enroute.rest.simple.provider

private void doResponses(OperationObject operationObject, Function function)
    throws Exception {
  doResponse(operationObject, function.method.getAnnotatedReturnType());
  for (AnnotatedType annotatedException : function.method
      .getAnnotatedExceptionTypes()) {
    doResponse(operationObject, annotatedException, annotatedException);
  }
}

代码示例来源:origin: airlift/drift

private ImmutableMap<Short, ThriftType> buildExceptionMap(ThriftCatalog catalog, ThriftMethod thriftMethod)
      stream(method.getAnnotatedExceptionTypes()).anyMatch(type -> type.isAnnotationPresent(ThriftId.class));
  checkArgument(!mixedStyle, "ThriftMethod [%s] uses a mix of @ThriftException and @ThriftId", methodName(method));
  AnnotatedType[] exceptionAnnotations = method.getAnnotatedExceptionTypes();
  for (int i = 0; i < allExceptionClasses.length; i++) {
    Class<?> exception = allExceptionClasses[i];

相关文章