Skip to content

Java library for parsing information from a structured Javadoc string.

License

Notifications You must be signed in to change notification settings

chhorz/javadoc-parser

Repository files navigation

Javadoc Parser

Java CI Maven Central

About

This library provides a parsing mechanism for Javadoc comments within java files. An initial documentation of the Javadoc tool can be found on the pages of Oracle: Javadoc Tool.

To get the parsing mechanism work properly the Javadoc comment has to follow a specific structure. The structure should be as close as possible to the Writers Guide from Oracle.

Usage

The project is available from maven central repository:

<dependency>
  <groupId>com.github.chhorz</groupId>
  <artifactId>javadoc-parser</artifactId>
  <version>${javadoc-parser.version}</version>
</dependency>

Information about the latest published version is available on the GitHub Releases page.

Javadoc comment structure

work in progress

Parser configuration

Parsing
JavaDocParser javaDocParser = JavaDocParserBuilder
		.withStandardJavadocTags()
		.withOutputType(OutputType.PLAIN)
		.build();

JavaDoc javaDoc = javaDocParser.parse("Javadoc as String");

Retrieving data

Getting data
List<AuthorTag> authorTags = javaDoc.getTags(AuthorTag.class);

AuthorTag firstAuthor = authorTags.get(0);

firstAuthor.getNameText();

Snapshots

Snapshots are available from the Sonatype OSS Snapshots repository. To configure the repository for your project to use the latest snapshot versions you have to add the following repository to your maven pom:

<repositories>
    <repository>
        <id>ossrh</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>

License

Javadoc Parser is open source software released under the Apache 2.0 license.