public final class JavaParser extends Object
This class was generated automatically by javacc, do not edit.
Parse Java 1.5 source code and creates Abstract Syntax Tree classes.
| Modifier and Type | Method and Description |
|---|---|
static CompilationUnit |
parse(File file)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(File file,
String encoding) |
static CompilationUnit |
parse(File file,
String encoding,
boolean considerComments)
Parses the Java code contained in a
File and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(InputStream in)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(InputStream in,
String encoding) |
static CompilationUnit |
parse(InputStream in,
String encoding,
boolean considerComments)
Parses the Java code contained in the
InputStream and returns a
CompilationUnit that represents it. |
static CompilationUnit |
parse(Reader reader,
boolean considerComments) |
static AnnotationExpr |
parseAnnotation(String annotation)
Parses the Java annotation contained in a
String and returns a
AnnotationExpr that represents it. |
static BlockStmt |
parseBlock(String blockStatement)
|
static BodyDeclaration |
parseBodyDeclaration(String body)
Parses the Java body declaration(e.g fields or methods) contained in a
String and returns a BodyDeclaration that represents it. |
static Expression |
parseExpression(String expression)
Parses the Java expression contained in a
String and returns a
Expression that represents it. |
static ImportDeclaration |
parseImport(String importDeclaration)
Parses the Java import contained in a
String and returns a
ImportDeclaration that represents it. |
static Statement |
parseStatement(String statement)
|
public static CompilationUnit parse(InputStream in, String encoding) throws ParseException
ParseExceptionpublic static CompilationUnit parse(InputStream in, String encoding, boolean considerComments) throws ParseException
InputStream and returns a
CompilationUnit that represents it.in - InputStream containing Java source codeencoding - encoding of the source codeParseException - if the source code has parser errorspublic static CompilationUnit parse(InputStream in) throws ParseException
InputStream and returns a
CompilationUnit that represents it.in - InputStream containing Java source codeParseException - if the source code has parser errorspublic static CompilationUnit parse(File file, String encoding) throws ParseException, IOException
ParseExceptionIOExceptionpublic static CompilationUnit parse(File file, String encoding, boolean considerComments) throws ParseException, IOException
File and returns a
CompilationUnit that represents it.file - File containing Java source codeencoding - encoding of the source codeParseException - if the source code has parser errorsIOExceptionpublic static CompilationUnit parse(File file) throws ParseException, IOException
File and returns a
CompilationUnit that represents it.file - File containing Java source codeParseException - if the source code has parser errorsIOExceptionpublic static CompilationUnit parse(Reader reader, boolean considerComments) throws ParseException
ParseExceptionpublic static BlockStmt parseBlock(String blockStatement) throws ParseException
blockStatement - String containing Java block codeParseException - if the source code has parser errorsIOExceptionpublic static Statement parseStatement(String statement) throws ParseException
statement - String containing Java statement codeParseException - if the source code has parser errorsIOExceptionpublic static ImportDeclaration parseImport(String importDeclaration) throws ParseException
String and returns a
ImportDeclaration that represents it.importDeclaration - String containing Java import codeParseException - if the source code has parser errorsIOExceptionpublic static Expression parseExpression(String expression) throws ParseException
String and returns a
Expression that represents it.expression - String containing Java expressionParseException - if the source code has parser errorsIOExceptionpublic static AnnotationExpr parseAnnotation(String annotation) throws ParseException
String and returns a
AnnotationExpr that represents it.annotation - String containing Java annotationParseException - if the source code has parser errorsIOExceptionpublic static BodyDeclaration parseBodyDeclaration(String body) throws ParseException
String and returns a BodyDeclaration that represents it.body - String containing Java body declarationParseException - if the source code has parser errorsIOExceptionCopyright © 2007–2017. All rights reserved.