JavaParser.
| Modifier and Type | Field and Description |
|---|---|
| private static ParserConfiguration |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ParserConfiguration | |
| private static <T extends Node> T | |
| private static JavaParser | |
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codeInputStream containing Java source code. It will be closed after parsing.encoding of the source code encoding)
Deprecated
set the encoding in the
Parses the Java code contained in the ParserConfiguration
InputStream and returns a
CompilationUnit that represents it.
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codeInputStream containing Java source code. It will be closed after parsing.Parses the Java code contained in the |
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codeFile containing Java source code. It will be closed after parsing.encoding of the source code encoding)
Deprecated
set the encoding in the
Parses the Java code contained in a ParserConfiguration
File and returns a
CompilationUnit that represents it.
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codeFile containing Java source code. It will be closed after parsing.Parses the Java code contained in a |
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codepath to a file containing Java source code path, final Charset encoding of the source code encoding)
Deprecated
set the encoding in the
Parses the Java code contained in a file and returns a
ParserConfiguration
CompilationUnit that represents it.
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codepath to a file containing Java source code path)Parses the Java code contained in a file and returns a
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codethe reader containing Java source code. It will be closed after parsing. reader)Parses Java code from a Reader and returns a
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codeJava source code code)Parses the Java code contained in code and returns a
|
| public static AnnotationExpr | Returns: AnnotationExpr representing the Java annotationString containing Java annotationParses the Java annotation contained in a |
| public static BodyDeclaration | Returns: BodyDeclaration representing the Java annotationString containing Java body declarationParses the Java annotation body declaration(e.g fields or methods) contained in a
|
| public static BlockStmt | Returns: BlockStmt representing the Java blockString containing Java block codeParses the Java block contained in a |
| public static BodyDeclaration | Returns: BodyDeclaration representing the Java interface bodythe body of a class or interface body)Parses a Java class or interface body declaration(e.g fields or methods) and returns a
|
| public static ClassOrInterfaceType | Returns: ClassOrInterfaceType representing the typethe type name like a.b.c.X or Y type)Parses a Java class or interface type name and returns a |
| public static ExplicitConstructorInvocationStmt | Returns: the AST for the statement.a statement like super("hello"); statement)Parses the this(...) and super(...) statements that may occur at the start of a constructor. |
| public static <T extends Expression> T | Returns: Expression representing the Java expressionString containing Java expressionParses the Java expression contained in a |
| public static ImportDeclaration | Returns: ImportDeclaration representing the Java import declarationString containing Java import codeParses the Java import contained in a |
| public static Javadoc | Returns: Javadoc representing the content of the commenta variable declaration like content)content of my javadoc\n * second line\n * third lineParses the content of a JavadocComment and returns a |
| public static MethodDeclaration | Returns: the AST for the method declarationa method declaration like "void foo() {}" methodDeclaration)Parses a method declaration and returns it as a MethodDeclaration. |
| public static ModuleDeclaration | Returns: the AST for the module declarationa declaration like "module X {}" moduleDeclaration)Parses a module declaration and returns it as a ModuleDeclaration. |
| public static ModuleDirective | Returns: the AST for the module directivea directive like "opens C;" moduleDirective)Parses a module directive and returns it as a ModuleDirective. |
| public static Name | |
| public static PackageDeclaration | Returns: the AST for the parametera declaration like "package com.microsoft.java;" packageDeclaration)Parses a package declaration and returns it as a PackageDeclaration. |
| public static Parameter | Returns: the AST for the parametera parameter like "int[] x" parameter)Parses a single parameter (a type and a name) and returns it as a Parameter. |
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codepath to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResource path)Parses the Java code contained in a resource and returns a
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codepath to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResource path, Charset encoding of the source code encoding)
Deprecated
set the encoding in the
Parses the Java code contained in a resource and returns a
ParserConfiguration
CompilationUnit that represents it.
|
| public static CompilationUnit | Returns: CompilationUnit representing the Java source codethe classLoader that is asked to load the resource classLoader, final String path to a resource containing Java source code. As resource is accessed through a class loader, a
leading "/" is not allowed in pathToResource path, Charset encoding)
Deprecated
set the encoding in the
Parses the Java code contained in a resource and returns a
ParserConfiguration
CompilationUnit that represents it.
|
| public static SimpleName | Returns: the AST for the namea name like "parameter_source" name)Parses a simple name (one that can NOT have "."s in it) and returns it as a SimpleName. |
| public static Statement | Returns: Statement representing the Java statementString containing Java statement codeParses the Java statement contained in a |
| public static Type | |
| public static TypeDeclaration | Returns: the AST for the type declarationa declaration like "class X {}" typeDeclaration)Parses a type declaration and returns it as a TypeDeclaration. |
| public static TypeParameter | Returns: the AST for the type parametera parameter like "T extends Serializable" typeParameter)Parses a type parameter and returns it as a TypeParameter |
| public static VariableDeclarationExpr | Returns: VariableDeclarationExpr representing the typea variable declaration like declaration)int x=2;Parses a variable declaration expression and returns a |
| public static void |
| configuration | back to summary |
|---|---|
| private static ParserConfiguration configuration | |
| StaticJavaParser | back to summary |
|---|---|
| private StaticJavaParser() | |
| getConfiguration | back to summary |
|---|---|
| public static ParserConfiguration getConfiguration() Get the configuration for the parse... methods. | |
| handleResult | back to summary |
|---|---|
| private static <T extends Node> T handleResult(ParseResult<T> result) | |
| newParser | back to summary |
|---|---|
| private static JavaParser newParser() | |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final InputStream in, Charset encoding)
Deprecated set the encoding in the Parses the Java code contained in the
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final InputStream in) Parses the Java code contained in the
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final File file, final Charset encoding) throws FileNotFoundException
Deprecated set the encoding in the Parses the Java code contained in a
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final File file) throws FileNotFoundException Parses the Java code contained in a
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final Path path, final Charset encoding) throws IOException
Deprecated set the encoding in the Parses the Java code contained in a file and returns a
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final Path path) throws IOException Parses the Java code contained in a file and returns a
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(final Reader reader) Parses Java code from a Reader and returns a
| |
| parse | back to summary |
|---|---|
| public static CompilationUnit parse(String code) Parses the Java code contained in code and returns a
| |
| parseAnnotation | back to summary |
|---|---|
| public static AnnotationExpr parseAnnotation(final String annotation) Parses the Java annotation contained in a
| |
| parseAnnotationBodyDeclaration | back to summary |
|---|---|
| public static BodyDeclaration Parses the Java annotation body declaration(e.g fields or methods) contained in a
| |
| parseBlock | back to summary |
|---|---|
| public static BlockStmt parseBlock(final String blockStatement) Parses the Java block contained in a
| |
| parseBodyDeclaration | back to summary |
|---|---|
| public static BodyDeclaration Parses a Java class or interface body declaration(e.g fields or methods) and returns a
| |
| parseClassOrInterfaceType | back to summary |
|---|---|
| public static ClassOrInterfaceType parseClassOrInterfaceType(String type) Parses a Java class or interface type name and returns a
| |
| parseExplicitConstructorInvocationStmt | back to summary |
|---|---|
| public static ExplicitConstructorInvocationStmt parseExplicitConstructorInvocationStmt(String statement) Parses the this(...) and super(...) statements that may occur at the start of a constructor.
| |
| parseExpression | back to summary |
|---|---|
| public static <T extends Expression> T parseExpression(final String expression) Parses the Java expression contained in a
| |
| parseImport | back to summary |
|---|---|
| public static ImportDeclaration parseImport(final String importDeclaration) Parses the Java import contained in a
| |
| parseJavadoc | back to summary |
|---|---|
| public static Javadoc parseJavadoc(String content) Parses the content of a JavadocComment and returns a
| |
| parseMethodDeclaration | back to summary |
|---|---|
| public static MethodDeclaration parseMethodDeclaration(String methodDeclaration) Parses a method declaration and returns it as a MethodDeclaration.
| |
| parseModuleDeclaration | back to summary |
|---|---|
| public static ModuleDeclaration parseModuleDeclaration(String moduleDeclaration) Parses a module declaration and returns it as a ModuleDeclaration.
| |
| parseModuleDirective | back to summary |
|---|---|
| public static ModuleDirective parseModuleDirective(String moduleDirective) Parses a module directive and returns it as a ModuleDirective.
| |
| parseName | back to summary |
|---|---|
| public static Name parseName(String qualifiedName) Parses a qualified name (one that can have "."s in it) and returns it as a Name.
| |
| parsePackageDeclaration | back to summary |
|---|---|
| public static PackageDeclaration parsePackageDeclaration(String packageDeclaration) Parses a package declaration and returns it as a PackageDeclaration.
| |
| parseParameter | back to summary |
|---|---|
| public static Parameter parseParameter(String parameter) Parses a single parameter (a type and a name) and returns it as a Parameter.
| |
| parseResource | back to summary |
|---|---|
| public static CompilationUnit parseResource(final String path) throws IOException Parses the Java code contained in a resource and returns a
| |
| parseResource | back to summary |
|---|---|
| public static CompilationUnit parseResource(final String path, Charset encoding) throws IOException
Deprecated set the encoding in the Parses the Java code contained in a resource and returns a
| |
| parseResource | back to summary |
|---|---|
| public static CompilationUnit parseResource(final ClassLoader classLoader, final String path, Charset encoding) throws IOException
Deprecated set the encoding in the Parses the Java code contained in a resource and returns a
| |
| parseSimpleName | back to summary |
|---|---|
| public static SimpleName parseSimpleName(String name) Parses a simple name (one that can NOT have "."s in it) and returns it as a SimpleName.
| |
| parseStatement | back to summary |
|---|---|
| public static Statement parseStatement(final String statement) Parses the Java statement contained in a
| |
| parseType | back to summary |
|---|---|
| public static Type parseType(String type) Parses a Java type name and returns a
| |
| parseTypeDeclaration | back to summary |
|---|---|
| public static TypeDeclaration Parses a type declaration and returns it as a TypeDeclaration.
| |
| parseTypeParameter | back to summary |
|---|---|
| public static TypeParameter parseTypeParameter(String typeParameter) Parses a type parameter and returns it as a TypeParameter
| |
| parseVariableDeclarationExpr | back to summary |
|---|---|
| public static VariableDeclarationExpr parseVariableDeclarationExpr(String declaration) Parses a variable declaration expression and returns a
| |
| setConfiguration | back to summary |
|---|---|
| public static void setConfiguration(ParserConfiguration configuration) Set the configuration for the static parse... methods. This is a STATIC field, so modifying it will directly change how all static parse... methods work! | |