net.sourceforge.pmd.lang.java

## Class AbstractJavaParser

- java.lang.Object
- - net.sourceforge.pmd.lang.AbstractParser
  - - net.sourceforge.pmd.lang.java.AbstractJavaParser

All Implemented Interfaces:
  Parser

Direct Known Subclasses:
  Java13Parser, Java14Parser, Java15Parser, Java16Parser, Java17Parser

    public abstract class AbstractJavaParser
    extends AbstractParser

This is a generic Java specific implementation of the Parser interface. It creates a JavaParser instance, and sets the exclude marker. It also exposes the exclude map from the JavaParser instance.

See Also:
  `AbstractParser`, `JavaParser`

### Field Summary

### Fields inherited from class net.sourceforge.pmd.lang.AbstractParser

`parserOptions`

### Constructor Summary

Constructors
Constructor and Description
`AbstractJavaParser(ParserOptions parserOptions)`

### Method Summary

Methods
`boolean` `canParse()` Indicates if this parser can actual parse, or if it can only tokenize.
`protected JavaParser` `createJavaParser(Reader source)` Subclass should override this method to modify the JavaParser as needed.
`TokenManager` `createTokenManager(Reader source)`
`Map<Integer,String>` `getSuppressMap()`
`Node` `parse(String fileName, Reader source)` Parse source code and return the root node of the AST.

### Methods inherited from class net.sourceforge.pmd.lang.AbstractParser

`getParserOptions, getTokenManager`

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

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

### Constructor Detail

#### AbstractJavaParser

    public AbstractJavaParser(ParserOptions parserOptions)

### Method Detail

#### createTokenManager

    public TokenManager createTokenManager(Reader source)

Specified by:
  `createTokenManager` in class `AbstractParser`

#### createJavaParser

    protected JavaParser createJavaParser(Reader source)
                                   throws ParseException

Subclass should override this method to modify the JavaParser as needed.

Throws:
  `ParseException`

#### canParse

    public boolean canParse()

Description copied from interface: `Parser`
Indicates if this parser can actual parse, or if it can only tokenize.

#### parse

    public Node parse(String fileName,
             Reader source)
               throws ParseException

Description copied from interface: `Parser`
Parse source code and return the root node of the AST.

Parameters:
  `fileName` - The file name being parsed (may be `null`).
  `source` - Reader that provides the source code of a compilation unit
Returns:
  the root node of the AST that is built from the source code
Throws:
  `ParseException` - In case the source code could not be parsed, probably due to syntactical errors.

#### getSuppressMap

    public Map<Integer,String> getSuppressMap()