How to determine whether the parameter of a method is an instance of interface or class ?

Recently, I was trying to create my first IntelliJ plugin. I used PsiMethod.getParameters() to get the parameter of a method, I want to know  whether the parameter is an instance of interface or class. What should i do?

Perhaps, the answer to this question has been clearly stated somewhere, but I haven't found yet. Wish you can help, thanks.

0

you can get the type of parameter and call `com.intellij.psi.util.PsiUtil#resolveClassInClassTypeOnly` to get the class which correspond to the parameter's type (note that primitive types, arrays, etc won't have a class) and then you may call `isInterface` on the resulted class.

Anna

1
Avatar
Permanently deleted user

Thank you very much for your answer. It solved my problem

0

请先登录再写评论。