下面列出了怎么用com.intellij.psi.PsiTypeParameterList的API类实例代码及写法,或者点击链接到github查看源代码。
private boolean isPsiMethodCamelLanguage(PsiMethod method) {
PsiType type = method.getReturnType();
if (type != null && type instanceof PsiClassReferenceType) {
PsiClassReferenceType clazz = (PsiClassReferenceType) type;
PsiClass resolved = clazz.resolve();
if (resolved != null) {
boolean language = getCamelIdeaUtils().isCamelExpressionOrLanguage(resolved);
// try parent using some weird/nasty stub stuff which is how complex IDEA AST
// is when its parsing the Camel route builder
if (!language) {
PsiElement elem = resolved.getParent();
if (elem instanceof PsiTypeParameterList) {
elem = elem.getParent();
}
if (elem instanceof PsiClass) {
language = getCamelIdeaUtils().isCamelExpressionOrLanguage((PsiClass) elem);
}
}
return language;
}
}
return false;
}
@Override
protected void visitJsonConfigAnnotation(final UAnnotation node, final PsiClass jsonType, final int genericTypesCount) {
final PsiTypeParameterList typeParameterList = jsonType.getTypeParameterList();
final int expectedGenericTypesCount = typeParameterList != null ? typeParameterList.getTypeParameters().length : 0;
if (expectedGenericTypesCount != genericTypesCount) {
report(node, String.format(Locale.getDefault(), DESC_FORMAT, jsonType.getName(), expectedGenericTypesCount, genericTypesCount));
}
}
public LombokLightClassBuilder withParameterTypes(@Nullable PsiTypeParameterList parameterList) {
if (parameterList != null) {
Stream.of(parameterList.getTypeParameters()).forEach(this::withParameterType);
}
return this;
}