com.github.javaparser.JavaParser.getStaticConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(847)

本文整理了Java中com.github.javaparser.JavaParser.getStaticConfiguration()方法的一些代码示例,展示了JavaParser.getStaticConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaParser.getStaticConfiguration()方法的具体详情如下:
包路径:com.github.javaparser.JavaParser
类名称:JavaParser
方法名:getStaticConfiguration

JavaParser.getStaticConfiguration介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

private ModuleDefinition parseModuleInfo(File moduleInfo) {
    try {
      ParserConfiguration.LanguageLevel languageLevel = JAVA_10;
      JavaParser.getStaticConfiguration().setLanguageLevel(languageLevel); // todo  to extension
      LOGGER.debug("Parsing module info at language level " + languageLevel);
      CompilationUnit compilationUnit = JavaParser.parse(String.join("\n", Files.readAllLines(moduleInfo.toPath())));
      ModuleDeclaration moduleDeclaration = compilationUnit.getModule().orElseThrow(() -> new RuntimeException("can`t get module info metadata from parsing"));
      List<ModuleRequiresStmt> list = moduleDeclaration.getModuleStmts().stream()
          .filter(stms -> stms instanceof ModuleRequiresStmt).map(stms -> (ModuleRequiresStmt) stms)
          .collect(Collectors.toList());
      return new ModuleDefinition(moduleDeclaration.getNameAsString(), list);
    } catch (IOException e) {
      LOGGER.error("Catch error while parsing module info " + moduleInfo.getName(), e);
    }
    return null;
  }
}

代码示例来源:origin: gradle.plugin.org.javamodularity/moduleplugin

Path moduleInfoJava = moduleInfoSrcDir.get().toPath().resolve("module-info.java");
try {
  JavaParser.getStaticConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_11);
  Optional<ModuleDeclaration> module = JavaParser.parse(moduleInfoJava).getModule();
  if (module.isPresent()) {

代码示例来源:origin: Refactoring-Bot/Refactoring-Bot

JavaParser.getStaticConfiguration().setSymbolResolver(javaSymbolSolver);

代码示例来源:origin: Refactoring-Bot/Refactoring-Bot

JavaParser.getStaticConfiguration().setSymbolResolver(javaSymbolSolver);

相关文章