Top Description Inners Fields Constructors Methods
com.github.javaparser

public Class ParseResult<T>

extends Object
Class Inheritance
Imports
com.github.javaparser.ast.Node, com.github.javaparser.ast.comments.CommentsCollection, java.util.List, .Optional, java.util.function.Consumer

The results given when parsing with an instance of JavaParser.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ParseResult.PostProcessor

A post processor that can be added to ParserConfiguration to add some processing right after parsing.

Field Summary

Modifier and TypeField and Description
private final CommentsCollection
private final List<Problem>
private final T

Constructor Summary

AccessConstructor and Description
public
ParseResult(T
the AST, or empty if it wasn't created.
result
,
List<Problem>
a list of encountered parsing problems.
problems
,
CommentsCollection commentsCollection)

General constructor.

Method Summary

Modifier and TypeMethod and Description
public Optional<CommentsCollection>

Returns:

the complete collection of comments encountered while parsing.
getCommentsCollection
()

public Problem

Returns:

the i'th encountered parsing problem. May throw IndexOutOfBoundsException.
getProblem
(int i)

public List<Problem>

Returns:

the list of encountered parsing problems. Empty when no problems were encountered.
getProblems
()

public Optional<T>

Returns:

the AST of the parsed source code, or empty if parsing failed completely.
getResult
()

public void
ifSuccessful(Consumer<T> consumer)

Calls the consumer with the result if parsing was succesful.

public boolean

Returns:

if parsing was successful, meaning no errors of any kind were encountered.
isSuccessful
()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

commentsCollectionback to summary
private final CommentsCollection commentsCollection
problemsback to summary
private final List<Problem> problems
resultback to summary
private final T result

Constructor Detail

ParseResultback to summary
public ParseResult(T result, List<Problem> problems, CommentsCollection commentsCollection)

General constructor.

Parameters
result:T

the AST, or empty if it wasn't created.

problems:List<Problem>

a list of encountered parsing problems.

Method Detail

getCommentsCollectionback to summary
public Optional<CommentsCollection> getCommentsCollection()
Returns:Optional<CommentsCollection>

the complete collection of comments encountered while parsing.

getProblemback to summary
public Problem getProblem(int i)
Returns:Problem

the i'th encountered parsing problem. May throw IndexOutOfBoundsException.

getProblemsback to summary
public List<Problem> getProblems()
Returns:List<Problem>

the list of encountered parsing problems. Empty when no problems were encountered.

getResultback to summary
public Optional<T> getResult()
Returns:Optional<T>

the AST of the parsed source code, or empty if parsing failed completely.

ifSuccessfulback to summary
public void ifSuccessful(Consumer<T> consumer)

Calls the consumer with the result if parsing was succesful.

isSuccessfulback to summary
public boolean isSuccessful()
Returns:boolean

if parsing was successful, meaning no errors of any kind were encountered.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
com.github.javaparser back to summary

public Interface ParseResult.PostProcessor

Known Direct Implementers
com.github.javaparser.version.PostProcessors

A post processor that can be added to ParserConfiguration to add some processing right after parsing.

Method Summary

Modifier and TypeMethod and Description
public void
process(ParseResult<? extends Node> result, ParserConfiguration configuration)

Method Detail

processback to summary
public void process(ParseResult<? extends Node> result, ParserConfiguration configuration)