japa.parser

## Class JavaParser

- java.lang.Object
- - japa.parser.JavaParser

    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.

Author:
  Júlio Vilmar Gesser

### Method Summary

All Methods Static Methods Concrete Methods
`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)` Parses the Java block contained in a `String` and returns a `BlockStmt` that represents it.
`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)` Parses the Java statement contained in a `String` and returns a `Statement` that represents it.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### parse

    public static CompilationUnit parse(InputStream in,
                                        String encoding)
                                 throws ParseException

Throws:
  `ParseException`

#### parse

    public static CompilationUnit parse(InputStream in,
                                        String encoding,
                                        boolean considerComments)
                                 throws ParseException

Parses the Java code contained in the `InputStream` and returns a `CompilationUnit` that represents it.

Parameters:
  `in` - `InputStream` containing Java source code
  `encoding` - encoding of the source code
Returns:
  CompilationUnit representing the Java source code
Throws:
  `ParseException` - if the source code has parser errors

#### parse

    public static CompilationUnit parse(InputStream in)
                                 throws ParseException

Parses the Java code contained in the `InputStream` and returns a `CompilationUnit` that represents it.

Parameters:
  `in` - `InputStream` containing Java source code
Returns:
  CompilationUnit representing the Java source code
Throws:
  `ParseException` - if the source code has parser errors

#### parse

    public static CompilationUnit parse(File file,
                                        String encoding)
                                 throws ParseException,
                                        IOException

Throws:
  `ParseException`
  `IOException`

#### parse

    public static CompilationUnit parse(File file,
                                        String encoding,
                                        boolean considerComments)
                                 throws ParseException,
                                        IOException

Parses the Java code contained in a `File` and returns a `CompilationUnit` that represents it.

Parameters:
  `file` - `File` containing Java source code
  `encoding` - encoding of the source code
Returns:
  CompilationUnit representing the Java source code
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parse

    public static CompilationUnit parse(File file)
                                 throws ParseException,
                                        IOException

Parses the Java code contained in a `File` and returns a `CompilationUnit` that represents it.

Parameters:
  `file` - `File` containing Java source code
Returns:
  CompilationUnit representing the Java source code
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parse

    public static CompilationUnit parse(Reader reader,
                                        boolean considerComments)
                                 throws ParseException

Throws:
  `ParseException`

#### parseBlock

    public static BlockStmt parseBlock(String blockStatement)
                                throws ParseException

Parses the Java block contained in a `String` and returns a `BlockStmt` that represents it.

Parameters:
  `blockStatement` - `String` containing Java block code
Returns:
  BlockStmt representing the Java block
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parseStatement

    public static Statement parseStatement(String statement)
                                    throws ParseException

Parses the Java statement contained in a `String` and returns a `Statement` that represents it.

Parameters:
  `statement` - `String` containing Java statement code
Returns:
  Statement representing the Java statement
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parseImport

    public static ImportDeclaration parseImport(String importDeclaration)
                                         throws ParseException

Parses the Java import contained in a `String` and returns a `ImportDeclaration` that represents it.

Parameters:
  `importDeclaration` - `String` containing Java import code
Returns:
  ImportDeclaration representing the Java import declaration
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parseExpression

    public static Expression parseExpression(String expression)
                                      throws ParseException

Parses the Java expression contained in a `String` and returns a `Expression` that represents it.

Parameters:
  `expression` - `String` containing Java expression
Returns:
  Expression representing the Java expression
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parseAnnotation

    public static AnnotationExpr parseAnnotation(String annotation)
                                          throws ParseException

Parses the Java annotation contained in a `String` and returns a `AnnotationExpr` that represents it.

Parameters:
  `annotation` - `String` containing Java annotation
Returns:
  AnnotationExpr representing the Java annotation
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`

#### parseBodyDeclaration

    public static BodyDeclaration parseBodyDeclaration(String body)
                                                throws ParseException

Parses the Java body declaration(e.g fields or methods) contained in a `String` and returns a `BodyDeclaration` that represents it.

Parameters:
  `body` - `String` containing Java body declaration
Returns:
  BodyDeclaration representing the Java annotation
Throws:
  `ParseException` - if the source code has parser errors
  `IOException`