本文整理了Java中com.github.javaparser.ast.CompilationUnit.addImport()
方法的一些代码示例,展示了CompilationUnit.addImport()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CompilationUnit.addImport()
方法的具体详情如下:
包路径:com.github.javaparser.ast.CompilationUnit
类名称:CompilationUnit
方法名:addImport
暂无
代码示例来源:origin: JCTools/JCTools
private static void organiseImports(CompilationUnit cu) {
List<ImportDeclaration> importDecls = new ArrayList<>();
for (ImportDeclaration importDeclaration : cu.getImports()) {
if (importDeclaration.getNameAsString().startsWith("org.jctools.util.Unsafe")) {
continue;
}
importDecls.add(importDeclaration);
}
cu.getImports().clear();
for (ImportDeclaration importDecl : importDecls) {
cu.addImport(importDecl);
}
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicLongFieldUpdater"));
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicReferenceArray"));
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicLongArray"));
}
代码示例来源:origin: JCTools/JCTools
cu.addImport(importDecl);
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicReferenceFieldUpdater"));
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicLongFieldUpdater"));
cu.addImport(importDeclaration("org.jctools.queues.MessagePassingQueue"));
cu.addImport(importDeclaration("org.jctools.queues.MessagePassingQueue.Supplier"));
cu.addImport(importDeclaration("org.jctools.queues.MessagePassingQueueUtil"));
cu.addImport(importDeclaration("org.jctools.queues.QueueProgressIndicators"));
cu.addImport(importDeclaration("org.jctools.queues.IndexedQueueSizeUtil"));
cu.addImport(staticImportDeclaration("org.jctools.queues.atomic.LinkedAtomicArrayQueueUtil.*"));
cu.addImport(importDeclaration("java.util.concurrent.atomic.AtomicReferenceArray"));
cu.addImport(importDeclaration("org.jctools.queues.MpmcArrayQueue"));
代码示例来源:origin: com.reprezen.jsonoverlay/jsonoverlay
public String format() {
CompilationUnit cu = new CompilationUnit();
if (fileComment != null) {
cu.addOrphanComment(new JavadocComment(fileComment));
}
cu.setPackageDeclaration(pkg);
for (String imp : imports) {
cu.addImport(imp);
}
cu.addType(type);
for (Member member : gatherFinalMembers(members, cu)) {
type.addMember(member.getDeclaration());
}
return cu.toString();
}
代码示例来源:origin: ftomassetti/analyze-java-code-examples
compilationUnit.addImport("java.util", false, true);
内容来源于网络,如有侵权,请联系作者删除!