代码之家  ›  专栏  ›  技术社区  ›  Justin Blank

从类名获取类

  •  0
  • Justin Blank  · 技术社区  · 7 年前

    我尝试使用

    psiClass.getMethods();
    // filter methods down to the one I'm looking for
    

    我可以找一个 PsiType 使用FQCN,但不知道如何获取 PsiClass 或者如果那是完全错误的方式。

    String className = "com.foo.Bar";
    PsiType type = PsiElementFactory.SERVICE.getInstance(project).getTypeByFQClassName(className);
    

    1 回复  |  直到 7 年前
        1
  •  0
  •   Tim Abhishek Kumar    7 年前

    如中所述 the documentation ,找到 PsiClass JavaPsiFacade.findClass() .