@Nullable
private TypeMirror getTypeArgument(TypeMirror annotatedType, final TypeElement baseType) {
for (TypeMirror type : getAllTypes(annotatedType)) {
TypeMirror typeArgument = type.accept(new SimpleTypeVisitor6<TypeMirror, Void>() {
@Override public TypeMirror visitDeclared(DeclaredType t, Void aVoid) {
if (isAssignable(t, baseType)) {
List<? extends TypeMirror> typeArguments = t.getTypeArguments();
if (!typeArguments.isEmpty()) {
return typeUtils.erasure(typeArguments.get(0));
}
}
return null;
}
}, null);
if (typeArgument != null) {
return typeArgument;
}
}
error("Failed to find a type argument for %s in %s", baseType, annotatedType);
return null;
}
CmdLineProcessor.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:Mastering-Mesos
作者:
评论列表
文章目录