本文整理了Java中java.lang.reflect.Constructor.getGenericExceptionTypes()
方法的一些代码示例,展示了Constructor.getGenericExceptionTypes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Constructor.getGenericExceptionTypes()
方法的具体详情如下:
包路径:java.lang.reflect.Constructor
类名称:Constructor
方法名:getGenericExceptionTypes
[英]Returns the exception types as an array of Type instances. If this constructor has no declared exceptions, an empty array will be returned.
[中]将异常类型作为类型实例数组返回。如果此构造函数没有声明的异常,则将返回空数组。
代码示例来源:origin: google/guava
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: prestodb/presto
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: google/j2objc
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: wildfly/wildfly
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: spring-projects/spring-loaded
public static List<Type> callGetGenericExceptionTypes(Constructor thiz) {
return Arrays.asList(thiz.getGenericExceptionTypes());
}
代码示例来源:origin: com.google.inject/guice
/**
* Returns the resolved generic exception types thrown by {@code constructor}.
*
* @param methodOrConstructor a method or constructor defined by this or any supertype.
* @since 2.0
*/
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
Type[] genericExceptionTypes;
if (methodOrConstructor instanceof Method) {
Method method = (Method) methodOrConstructor;
checkArgument(
method.getDeclaringClass().isAssignableFrom(rawType),
"%s is not defined by a supertype of %s",
method,
type);
genericExceptionTypes = method.getGenericExceptionTypes();
} else if (methodOrConstructor instanceof Constructor) {
Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
checkArgument(
constructor.getDeclaringClass().isAssignableFrom(rawType),
"%s does not construct a supertype of %s",
constructor,
type);
genericExceptionTypes = constructor.getGenericExceptionTypes();
} else {
throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
}
return resolveAll(genericExceptionTypes);
}
代码示例来源:origin: redisson/redisson
@Override
@CachedReturnPlugin.Enhance("resolved")
protected TypeDescription.Generic resolve() {
java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes();
return erasure.length == type.length
? Sort.describe(type[index], getAnnotationReader())
: asRawType();
}
代码示例来源:origin: org.codehaus.groovy/groovy
getConstructorParameterAnnotations(ctor)
);
ClassNode[] exceptions = makeClassNodes(compileUnit, ctor.getGenericExceptionTypes(), ctor.getExceptionTypes());
classNode.addConstructor(ctor.getModifiers(), params, exceptions, null);
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Returns the resolved generic exception types thrown by {@code constructor}.
*
* @param methodOrConstructor a method or constructor defined by this or any supertype.
* @since 2.0
*/
public List<TypeLiteral<?>> getExceptionTypes(Member methodOrConstructor) {
Type[] genericExceptionTypes;
if (methodOrConstructor instanceof Method) {
Method method = (Method) methodOrConstructor;
if (!method.getDeclaringClass().isAssignableFrom(rawType)) {
throw new IllegalArgumentException(method + " is not defined by a supertype of " + type);
}
genericExceptionTypes = method.getGenericExceptionTypes();
} else if (methodOrConstructor instanceof Constructor) {
Constructor<?> constructor = (Constructor<?>) methodOrConstructor;
if (!constructor.getDeclaringClass().isAssignableFrom(rawType)) {
throw new IllegalArgumentException(constructor + " does not construct a supertype of " + type);
}
genericExceptionTypes = constructor.getGenericExceptionTypes();
} else {
throw new IllegalArgumentException("Not a method or a constructor: " + methodOrConstructor);
}
return resolveAll(genericExceptionTypes);
}
代码示例来源:origin: webx/citrus
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) {
if (buildingCache == null) {
buildingCache = new BuildingCache();
}
MethodImpl methodInfo = buildingCache.getConstructor(constructor);
if (methodInfo == null) {
methodInfo = new MethodImpl(constructor);
buildingCache.setGenericDeclaration(constructor, methodInfo);
buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(),
constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache);
}
return methodInfo;
}
代码示例来源:origin: webx/citrus
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) {
if (buildingCache == null) {
buildingCache = new BuildingCache();
}
MethodImpl methodInfo = buildingCache.getConstructor(constructor);
if (methodInfo == null) {
methodInfo = new MethodImpl(constructor);
buildingCache.setGenericDeclaration(constructor, methodInfo);
buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(),
constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache);
}
return methodInfo;
}
代码示例来源:origin: webx/citrus
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) {
if (buildingCache == null) {
buildingCache = new BuildingCache();
}
MethodImpl methodInfo = buildingCache.getConstructor(constructor);
if (methodInfo == null) {
methodInfo = new MethodImpl(constructor);
buildingCache.setGenericDeclaration(constructor, methodInfo);
buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(),
constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache);
}
return methodInfo;
}
代码示例来源:origin: io.prestosql/presto-jdbc
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: org.apache.drill/drill-shaded-guava
@Override
Type[] getGenericExceptionTypes() {
return constructor.getGenericExceptionTypes();
}
代码示例来源:origin: com.blazebit/blaze-common-utils
public Class<?>[] getResolvedTypeParameters(Class<?> concreteClass) {
Type t = method != null ? method.getGenericExceptionTypes()[index]
: constructor.getGenericExceptionTypes()[index];
return ReflectionUtils.resolveTypeArguments(concreteClass, t);
}
代码示例来源:origin: com.fitbur.external/external-bytebuddy
@Override
protected TypeDescription.Generic resolve() {
java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes();
return erasure.length == type.length
? Sort.describe(type[index], getAnnotationReader())
: asRawType();
}
代码示例来源:origin: org.testifyproject.external/external-bytebuddy
@Override
protected TypeDescription.Generic resolve() {
java.lang.reflect.Type[] type = constructor.getGenericExceptionTypes();
return erasure.length == type.length
? Sort.describe(type[index], getAnnotationReader())
: asRawType();
}
代码示例来源:origin: com.alibaba.citrus/citrus-webx-all
private MethodInfo buildConstructor(Constructor<?> constructor, BuildingCache buildingCache) {
if (buildingCache == null) {
buildingCache = new BuildingCache();
}
MethodImpl methodInfo = buildingCache.getConstructor(constructor);
if (methodInfo == null) {
methodInfo = new MethodImpl(constructor);
buildingCache.setGenericDeclaration(constructor, methodInfo);
buildMethodOrConstructor(methodInfo, null, constructor.getGenericParameterTypes(),
constructor.getGenericExceptionTypes(), constructor.getDeclaringClass(), buildingCache);
}
return methodInfo;
}
代码示例来源:origin: com.blazebit/blaze-common-utils
public Class<?> getResolvedType(Class<?> concreteClass) {
Type t = method != null ? method.getGenericExceptionTypes()[index]
: constructor.getGenericExceptionTypes()[index];
if (t instanceof TypeVariable<?>) {
return ReflectionUtils.resolveTypeVariable(concreteClass,
(TypeVariable<?>) t);
}
return getType();
}
代码示例来源:origin: babyfish-ct/babyfish
MethodBase(Constructor<?> constructor, ClassInfo<?> declaringType) {
super (constructor, declaringType);
this.typeParameters = MACollections.wrap((TypeVariable<?>[])constructor.getTypeParameters());
this.parameterTypes = MACollections.wrap(constructor.getParameterTypes());
this.genericParameterTypes = MACollections.wrap(constructor.getGenericParameterTypes());
this.exceptionTypes = MACollections.wrap(constructor.getExceptionTypes());
this.genericExceptionTypes = MACollections.wrap(constructor.getGenericExceptionTypes());
}
内容来源于网络,如有侵权,请联系作者删除!