This addon exports services for use in other addons. The Java parser addon provides APIs and services for parsing Java types including classes, enums, interfaces, annotations, and package-info types.
This Addon requires the following installation steps.
To use this addon, you must add it as a dependency in the pom.xml of your forge-addon
classified artifact:
<dependency>
<groupId>org.jboss.forge.addon</groupId>
<artifactId>parser-java</artifactId>
<classifier>forge-addon</classifier>
<version>${version}</version>
</dependency>
- Roaster for java source parsing and generation
-
Roaster allows for parsing and generation of Java sources via a type-safe and fluent API.
JavaClassSource<?> myClass = Roaster.parse(JavaClassSource.class, "public class MyClass{}");
- (Optional) projects addon integration
-
When the projects addon is installed, several
ProjectFacet
implementations will be retrievable from appropriately configured projects that include java source code.-
JavaCompilerFacet - used to control the project Java compiler version.
-
JavaSourceFacet - used to manipulate project Java source files.
Project project = ... JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
-
- (Optional) resources addon integration
-
When the resources addon is installed, additional resources types for dealing with java types, methods and fields will be available for use via the
ResourceFactory
.ResourceFactory factory = ... JavaResource resource = (JavaResource) factory.create(new File(".../MyJavaClass.java"));
JavaResource
types also exposeJavaFieldResource
andJavaMethodResource
viaJavaResource.listResources()
. - (Optional) ui-spi addon integration
-
When the ui-spi addon is installed, the InputType.JAVA_CLASS_PICKER input type hint will be registered for UIInput<JavaResource> instances.