How can I create a PsiClass extends a PsiClass With Generic Type
Example
interface IModel{
}
interface IView{
}
interface IPresenter extends ILAMvpPresenter<IModel,IView> {
}
Assume the ILAMvpPresenter already exists,how can I create IPresenter extends a existed interface with generic types
请先登录再写评论。
You can create class from text or create a class by name and then add generic class reference to the extends list (to get the extends list: `com.intellij.psi.PsiClass#getExtendsList`; to create PSI from type: `com.intellij.psi.PsiElementFactory#createReferenceElementByType`; to create generic type by class and the substitution: `com.intellij.psi.PsiElementFactory#createType(com.intellij.psi.PsiClass, com.intellij.psi.PsiSubstitutor)`, to fill the substitution: `com.intellij.psi.PsiSubstitutor#EMPTY` and `put` in it type parameter -> class type pairs)
Anna