/**
* Given an input class, finds the usage of 'wanted', and returns the
* annotated type number of param.
*/
public static AnnotatedType getParamterOfInterface(Class<?> klass, Class<?> wanted, int param) {
final AnnotatedType val = TypeUtils.getInterfaceType(klass, wanted);
if (val == null) {
// no base class implements the given interface
return null;
}
//
if (!(val instanceof AnnotatedParameterizedType)) {
throw new IllegalArgumentException("is not a parameterized type");
}
final AnnotatedParameterizedType ptype = (AnnotatedParameterizedType) val;
if (param >= ptype.getAnnotatedActualTypeArguments().length) {
throw new IllegalArgumentException("too many");
}
return ptype.getAnnotatedActualTypeArguments()[param];
}
TypeUtils.java 文件源码
java
阅读 49
收藏 0
点赞 0
评论 0
项目:graphql
作者:
评论列表
文章目录