Package com.github.javaparser
Class ParseResult<T>
java.lang.Object
com.github.javaparser.ParseResult<T>
The results given when parsing with an instance of JavaParser.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A post processor that can be added to ParserConfiguration to add some processing right after parsing. -
Constructor Summary
ConstructorsConstructorDescriptionParseResult(T result, List<Problem> problems, CommentsCollection commentsCollection)
General constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetProblem(int i)
void
ifSuccessful(Consumer<T> consumer)
Calls the consumer with the result if parsing was succesful.boolean
toString()
-
Constructor Details
-
ParseResult
General constructor.- Parameters:
result
- the AST, or empty if it wasn't created.problems
- a list of encountered parsing problems.
-
-
Method Details
-
isSuccessful
public boolean isSuccessful()- Returns:
- if parsing was successful, meaning no errors of any kind were encountered.
-
ifSuccessful
Calls the consumer with the result if parsing was succesful. -
getProblems
- Returns:
- the list of encountered parsing problems. Empty when no problems were encountered.
-
getProblem
- Returns:
- the
i
'th encountered parsing problem. May throwIndexOutOfBoundsException
.
-
getCommentsCollection
- Returns:
- the complete collection of comments encountered while parsing.
-
getResult
- Returns:
- the AST of the parsed source code, or empty if parsing failed completely.
-
toString
-