Uses of Class
com.github.javaparser.ast.CompilationUnit
Packages that use CompilationUnit
Package
Description
Implementation of model based on JavaParser.
-
Uses of CompilationUnit in com.github.javaparser
Fields in com.github.javaparser with type parameters of type CompilationUnitModifier and TypeFieldDescriptionstatic final ParseStart
<CompilationUnit> ParseStart.COMPILATION_UNIT
Methods in com.github.javaparser that return CompilationUnitModifier and TypeMethodDescriptionfinal CompilationUnit
GeneratedJavaParser.CompilationUnit()
JavaParserAdapter.parse
(InputStream in) static CompilationUnit
static CompilationUnit
Deprecated.static CompilationUnit
StaticJavaParser.parse
(InputStream in) static CompilationUnit
StaticJavaParser.parse
(InputStream in, Charset encoding) Deprecated.set the encoding in theParserConfiguration
static CompilationUnit
Parses Java code from a Reader and returns aCompilationUnit
that represents it.static CompilationUnit
Parses the Java code contained in code and returns aCompilationUnit
that represents it.static CompilationUnit
Parses the Java code contained in a file and returns aCompilationUnit
that represents it.static CompilationUnit
Deprecated.set the encoding in theParserConfiguration
JavaParserAdapter.parseResource
(String path) static CompilationUnit
StaticJavaParser.parseResource
(ClassLoader classLoader, String path, Charset encoding) Deprecated.set the encoding in theParserConfiguration
static CompilationUnit
StaticJavaParser.parseResource
(String path) Parses the Java code contained in a resource and returns aCompilationUnit
that represents it.static CompilationUnit
StaticJavaParser.parseResource
(String path, Charset encoding) Deprecated.set the encoding in theParserConfiguration
Methods in com.github.javaparser that return types with arguments of type CompilationUnitModifier and TypeMethodDescriptionDeprecated.set the encoding in theParserConfiguration
JavaParser.parse
(InputStream in) JavaParser.parse
(InputStream in, Charset encoding) Parses the Java code contained in theInputStream
and returns aCompilationUnit
that represents it.Parses Java code from a Reader and returns aCompilationUnit
that represents it.Parses the Java code contained in code and returns aCompilationUnit
that represents it.Parses the Java code contained in a file and returns aCompilationUnit
that represents it.Deprecated.set the encoding in theParserConfiguration
JavaParser.parseResource
(ClassLoader classLoader, String path, Charset encoding) Deprecated.set the encoding in theParserConfiguration
JavaParser.parseResource
(String path) Parses the Java code contained in a resource and returns aCompilationUnit
that represents it.JavaParser.parseResource
(String path, Charset encoding) Deprecated.set the encoding in theParserConfiguration
Methods in com.github.javaparser with parameters of type CompilationUnitModifier and TypeMethodDescriptionprivate void
CommentsInserter.insertComments
(CompilationUnit cu, TreeSet<Comment> comments) Comments are attributed to the thing they comment and are removed from the comments. -
Uses of CompilationUnit in com.github.javaparser.ast
Fields in com.github.javaparser.ast declared as CompilationUnitModifier and TypeFieldDescriptionprivate final CompilationUnit
CompilationUnit.Storage.compilationUnit
Methods in com.github.javaparser.ast that return CompilationUnitModifier and TypeMethodDescriptionCompilationUnit.addImport
(ImportDeclaration importDeclaration) adds an import if not implicitly imported by java (i.e.Add an import to the list ofImportDeclaration
of this compilation unit
shorthand foraddImport(String)
with clazz.getName()Add an import to the list ofImportDeclaration
of this compilation unit
shorthand foraddImport(String, boolean, boolean)
with name,false,falseAdd an import to the list ofImportDeclaration
of this compilation unit
This method check if no import with the same name is already in the listCompilationUnit.addType
(TypeDeclaration<?> type) CompilationUnit.clone()
CompilationUnit.Storage.getCompilationUnit()
Declare a specific printerCompilationUnit.removeModule()
CompilationUnit.removePackageDeclaration()
CompilationUnit.setImport
(int i, ImportDeclaration imports) CompilationUnit.setImports
(NodeList<ImportDeclaration> imports) Sets the list of imports of this compilation unit.CompilationUnit.setModule
(ModuleDeclaration module) CompilationUnit.setPackageDeclaration
(PackageDeclaration packageDeclaration) Sets or clear the package declarations of this compilation unit.CompilationUnit.setPackageDeclaration
(String name) sets the package declaration of this compilation unitCompilationUnit.setStorage
(Path path) CompilationUnit.setStorage
(Path path, Charset charset) CompilationUnit.setType
(int i, TypeDeclaration<?> type) CompilationUnit.setTypes
(NodeList<TypeDeclaration<?>> types) Sets the list of types declared in this compilation unit.Methods in com.github.javaparser.ast that return types with arguments of type CompilationUnitModifier and TypeMethodDescriptionNode.findCompilationUnit()
CompilationUnit.Storage.reparse
(JavaParser javaParser) Method parameters in com.github.javaparser.ast with type arguments of type CompilationUnitModifier and TypeMethodDescriptionvoid
CompilationUnit.Storage.save
(Function<CompilationUnit, String> makeOutput) Saves a compilation unit to its original location with formatting according to the function passed as a parameter.void
CompilationUnit.Storage.save
(Function<CompilationUnit, String> makeOutput, Charset encoding) Saves a compilation unit to its original location with formatting and encoding according to the function and encoding passed as a parameter.Constructors in com.github.javaparser.ast with parameters of type CompilationUnitModifierConstructorDescriptionprivate
Storage
(CompilationUnit compilationUnit, Path path) private
Storage
(CompilationUnit compilationUnit, Path path, Charset encoding) -
Uses of CompilationUnit in com.github.javaparser.ast.visitor
Methods in com.github.javaparser.ast.visitor with parameters of type CompilationUnitModifier and TypeMethodDescriptionCloneVisitor.visit
(CompilationUnit n, Object arg) EqualsVisitor.visit
(CompilationUnit n, Visitable arg) GenericListVisitorAdapter.visit
(CompilationUnit n, A arg) GenericVisitor.visit
(CompilationUnit n, A arg) GenericVisitorAdapter.visit
(CompilationUnit n, A arg) GenericVisitorWithDefaults.visit
(CompilationUnit n, A arg) HashCodeVisitor.visit
(CompilationUnit n, Void arg) ModifierVisitor.visit
(CompilationUnit n, A arg) NoCommentEqualsVisitor.visit
(CompilationUnit n, Visitable arg) NoCommentHashCodeVisitor.visit
(CompilationUnit n, Void arg) void
NodeFinderVisitor.visit
(CompilationUnit n, Range arg) ObjectIdentityEqualsVisitor.visit
(CompilationUnit n, Visitable arg) ObjectIdentityHashCodeVisitor.visit
(CompilationUnit n, Void arg) void
VoidVisitor.visit
(CompilationUnit n, A arg) void
VoidVisitorAdapter.visit
(CompilationUnit n, A arg) void
VoidVisitorWithDefaults.visit
(CompilationUnit n, A arg) -
Uses of CompilationUnit in com.github.javaparser.printer
Methods in com.github.javaparser.printer with parameters of type CompilationUnitModifier and TypeMethodDescriptionvoid
DefaultPrettyPrinterVisitor.visit
(CompilationUnit n, Void arg) void
PrettyPrintVisitor.visit
(CompilationUnit n, Void arg) Deprecated. -
Uses of CompilationUnit in com.github.javaparser.resolution
Methods in com.github.javaparser.resolution with parameters of type CompilationUnitModifier and TypeMethodDescriptionstatic ClassOrInterfaceDeclaration
Navigator.demandClass
(CompilationUnit cu, String qualifiedName) static ClassOrInterfaceDeclaration
Navigator.demandClassOrInterface
(CompilationUnit compilationUnit, String qualifiedName) static EnumDeclaration
Navigator.demandEnum
(CompilationUnit cu, String qualifiedName) static ClassOrInterfaceDeclaration
Navigator.demandInterface
(CompilationUnit cu, String qualifiedName) static Optional
<TypeDeclaration<?>> Navigator.findType
(CompilationUnit cu, String qualifiedName) Looks among the type declared in the Compilation Unit for one having the specified name. -
Uses of CompilationUnit in com.github.javaparser.symbolsolver
Methods in com.github.javaparser.symbolsolver with parameters of type CompilationUnitModifier and TypeMethodDescriptionvoid
JavaSymbolSolver.inject
(CompilationUnit destination) Register this SymbolResolver into a CompilationUnit, so that symbol resolution becomes available to all nodes part of the CompilationUnit. -
Uses of CompilationUnit in com.github.javaparser.symbolsolver.javaparsermodel
Methods in com.github.javaparser.symbolsolver.javaparsermodel with parameters of type CompilationUnitModifier and TypeMethodDescriptionDefaultVisitorAdapter.visit
(CompilationUnit node, Boolean aBoolean) -
Uses of CompilationUnit in com.github.javaparser.symbolsolver.javaparsermodel.contexts
Constructors in com.github.javaparser.symbolsolver.javaparsermodel.contexts with parameters of type CompilationUnitModifierConstructorDescriptionCompilationUnitContext
(CompilationUnit wrappedNode, TypeSolver typeSolver) -
Uses of CompilationUnit in com.github.javaparser.symbolsolver.resolution.typesolvers
Fields in com.github.javaparser.symbolsolver.resolution.typesolvers with type parameters of type CompilationUnitModifier and TypeFieldDescriptionprivate final Cache
<Path, List<CompilationUnit>> JavaParserTypeSolver.parsedDirectories
private final Cache
<Path, Optional<CompilationUnit>> JavaParserTypeSolver.parsedFiles
Methods in com.github.javaparser.symbolsolver.resolution.typesolvers that return types with arguments of type CompilationUnitModifier and TypeMethodDescriptionprivate Optional
<CompilationUnit> private List
<CompilationUnit> JavaParserTypeSolver.parseDirectory
(Path srcDirectory) Note that this parse only files directly contained in this directory.private List
<CompilationUnit> JavaParserTypeSolver.parseDirectory
(Path srcDirectory, boolean recursively) private List
<CompilationUnit> JavaParserTypeSolver.parseDirectoryRecursively
(Path srcDirectory) Constructor parameters in com.github.javaparser.symbolsolver.resolution.typesolvers with type arguments of type CompilationUnitModifierConstructorDescriptionJavaParserTypeSolver
(Path srcDir, JavaParser javaParser, Cache<Path, Optional<CompilationUnit>> parsedFilesCache, Cache<Path, List<CompilationUnit>> parsedDirectoriesCache, Cache<String, SymbolReference<ResolvedReferenceTypeDeclaration>> foundTypesCache) Create aJavaParserTypeSolver
with a custom cache system. -
Uses of CompilationUnit in com.github.javaparser.utils
Fields in com.github.javaparser.utils with type parameters of type CompilationUnitModifier and TypeFieldDescriptionprivate final Map
<Path, ParseResult<CompilationUnit>> SourceRoot.cache
private Function
<CompilationUnit, String> SourceRoot.printer
Methods in com.github.javaparser.utils that return CompilationUnitModifier and TypeMethodDescriptionParses a .java files under the source root and returns its CompilationUnit.Methods in com.github.javaparser.utils that return types with arguments of type CompilationUnitModifier and TypeMethodDescriptionSourceRoot.getCache()
The Java files that have been parsed by this source root object, or have been added manually.SourceRoot.getCompilationUnits()
The CompilationUnits of the Java files that have been parsed succesfully by this source root object, or have been added manually.SourceRoot.getPrinter()
Get the printing function.SourceZip.parse()
Tries to parse all '.java' files in the ZIP located at this SourceZip's path and returns the parse results in a list.SourceRoot.tryToParse()
Tries to parse all .java files under the source root recursively, and returns all files ever parsed with this source root.SourceRoot.tryToParse
(String startPackage) Tries to parse all .java files in a package recursively, and returns all files ever parsed with this source root.SourceRoot.tryToParse
(String startPackage, String filename) Tries to parse a .java files under the source root and returns the ParseResult.SourceRoot.tryToParse
(String startPackage, String filename, ParserConfiguration configuration) Tries to parse a .java files under the source root and returns the ParseResult.SourceRoot.tryToParseParallelized()
Tries to parse all .java files under the source root recursively using multiple threads, and returns all files ever parsed with this source root.SourceRoot.tryToParseParallelized
(String startPackage) Tries to parse all .java files in a package recursively using multiple threads, and returns all files ever parsed with this source root.Methods in com.github.javaparser.utils with parameters of type CompilationUnitModifier and TypeMethodDescriptionSourceRoot.add
(CompilationUnit compilationUnit) Add a newly created Java file to the cache of this source root.SourceRoot.add
(String startPackage, String filename, CompilationUnit compilationUnit) Add a newly created Java file to the cache of this source root.private SourceRoot
SourceRoot.save
(CompilationUnit cu, Path path) Save the given compilation unit to the given path.private SourceRoot
SourceRoot.save
(CompilationUnit cu, Path path, Charset encoding) Save the given compilation unit to the given path.Method parameters in com.github.javaparser.utils with type arguments of type CompilationUnitModifier and TypeMethodDescriptionSourceRoot.Callback.process
(Path localPath, Path absolutePath, ParseResult<CompilationUnit> result) void
SourceZip.Callback.process
(Path relativeZipEntryPath, ParseResult<CompilationUnit> result) Process the given parse result.SourceRoot.setPrinter
(Function<CompilationUnit, String> printer) Set the printing function that transforms compilation units into a string to save.
ParserConfiguration