public interface JavaSourceFacet extends ProjectFacet
Modifier and Type | Method and Description |
---|---|
String |
calculateName(JavaResource resource)
Return the class name for the given
JavaResource whether it exists or not. |
String |
calculatePackage(JavaResource resource)
Return the package for the given
JavaResource whether it exists or not. |
String |
getBasePackage()
|
DirectoryResource |
getBasePackageDirectory()
Return the base Java
Package for this project, returned as a DirectoryResource |
JavaResource |
getJavaResource(org.jboss.forge.roaster.model.source.JavaSource<?> javaClass)
Attempt to locate and re-parse the given
JavaSource from its location on disk, relative to
getSourceDirectory() . |
JavaResource |
getJavaResource(String relativePath)
Return the
JavaClass at the given path relative to getSourceDirectory() . |
DirectoryResource |
getPackage(String packageName)
Return the package in the specified path under the
DirectoryResource returned in
getSourceDirectory() |
List<DirectoryResource> |
getSourceDirectories()
Get a list of
DirectoryResource s this project uses to contain Project source documents (such as
.java files.) |
DirectoryResource |
getSourceDirectory()
Get the
DirectoryResource this Project uses to store package-able source documents (such as .java
files.) |
JavaResource |
getTestJavaResource(org.jboss.forge.roaster.model.source.JavaSource<?> javaClass)
Attempt to locate and re-parse the given
JavaClass from its location on disk, relative to
getTestSourceDirectory() . |
JavaResource |
getTestJavaResource(String relativePath)
Return the
JavaClass at the given path relative to getTestSourceDirectory() . |
DirectoryResource |
getTestPackage(String packageName)
Returns the package in the specified path under the
DirectoryResource returned in
getTestSourceDirectory() |
DirectoryResource |
getTestSourceDirectory()
Get the
DirectoryResource this Project uses to store test-scoped source documents (such as .java
files.) Files in this directory will never be packaged or deployed except when running Unit Tests. |
JavaResource |
saveJavaSource(org.jboss.forge.roaster.model.source.JavaSource<?> source)
Create or update a Java file in the primary source directory:
getSourceDirectory() - use information in
the given JavaSource to determine the appropriate package; packages
will be created if necessary. |
default JavaResource |
saveJavaSourceUnformatted(org.jboss.forge.roaster.model.source.JavaSource<?> source)
Create or update a Java file without formatting in the primary source directory:
getSourceDirectory() - use information in the given
JavaSource to determine the appropriate package; packages will be
created if necessary. |
DirectoryResource |
savePackage(String packageName,
boolean createPackageInfo)
Create a package in the specified path under the
DirectoryResource returned in
getSourceDirectory() |
JavaResource |
saveTestJavaSource(org.jboss.forge.roaster.model.source.JavaSource<?> source)
Create or update a Java file in the primary test source directory:
getTestSourceDirectory() - use
information in the given JavaSource to determine the appropriate
package; packages will be created if necessary. |
default JavaResource |
saveTestJavaSourceUnformatted(org.jboss.forge.roaster.model.source.JavaSource<?> source)
Create or update a Java file without formatting in the primary test source directory:
getTestSourceDirectory() - use information in the given
JavaSource to determine the appropriate package; packages will be
created if necessary. |
DirectoryResource |
saveTestPackage(String packageName,
boolean createPackageInfo)
Create a package in the specified path under the
DirectoryResource returned in
getTestSourceDirectory() |
void |
visitJavaSources(JavaResourceVisitor visitor)
Recursively loops over all the source directories and for each java file it finds, calls the visitor.
|
void |
visitJavaTestSources(JavaResourceVisitor visitor)
Recursively loops over all the test source directories and for each java file it finds, calls the visitor.
|
getFaceted, install, isInstalled, uninstall
String calculateName(JavaResource resource)
JavaResource
whether it exists or not.String calculatePackage(JavaResource resource)
JavaResource
whether it exists or not.String getBasePackage()
DirectoryResource getBasePackageDirectory()
Package
for this project, returned as a DirectoryResource
List<DirectoryResource> getSourceDirectories()
DirectoryResource
s this project uses to contain Project
source documents (such as
.java files.)DirectoryResource getSourceDirectory()
DirectoryResource
this Project
uses to store package-able source documents (such as .java
files.)DirectoryResource getTestSourceDirectory()
DirectoryResource
this Project
uses to store test-scoped source documents (such as .java
files.) Files in this directory will never be packaged or deployed except when running Unit Tests.JavaResource saveJavaSource(org.jboss.forge.roaster.model.source.JavaSource<?> source)
getSourceDirectory()
- use information in
the given JavaSource
to determine the appropriate package; packages
will be created if necessary.source
- The java class to createJavaResource
FileNotFoundException
default JavaResource saveJavaSourceUnformatted(org.jboss.forge.roaster.model.source.JavaSource<?> source)
getSourceDirectory()
- use information in the given
JavaSource
to determine the appropriate package; packages will be
created if necessary.source
- JavaResource saveTestJavaSource(org.jboss.forge.roaster.model.source.JavaSource<?> source)
getTestSourceDirectory()
- use
information in the given JavaSource
to determine the appropriate
package; packages will be created if necessary.source
- The java class to createJavaResource
default JavaResource saveTestJavaSourceUnformatted(org.jboss.forge.roaster.model.source.JavaSource<?> source)
getTestSourceDirectory()
- use information in the given
JavaSource
to determine the appropriate package; packages will be
created if necessary.source
- The java class to createJavaResource
JavaResource getJavaResource(String relativePath)
JavaClass
at the given path relative to getSourceDirectory()
.relativePath
- The file or package path of the target Java source file.FileNotFoundException
- if the target JavaResource
does not existJavaResource getJavaResource(org.jboss.forge.roaster.model.source.JavaSource<?> javaClass)
JavaSource
from its location on disk, relative to
getSourceDirectory()
. The given instance will not be modified, and a new instance will be returned.javaClass
- The JavaClass
to re-parse.FileNotFoundException
- if the target JavaResource
does not existJavaResource getTestJavaResource(String relativePath)
JavaClass
at the given path relative to getTestSourceDirectory()
.relativePath
- The package path of the target Java source JavaResource
.JavaResource getTestJavaResource(org.jboss.forge.roaster.model.source.JavaSource<?> javaClass)
JavaClass
from its location on disk, relative to
getTestSourceDirectory()
. The given instance will not be modified, and a new instance will be returned.javaClass
- The JavaClass
to re-parse.FileNotFoundException
- if the target JavaResource
does not existvoid visitJavaSources(JavaResourceVisitor visitor)
visitor
- The JavaResourceVisitor
that processes all the found java files. Cannot be null.void visitJavaTestSources(JavaResourceVisitor visitor)
visitor
- The JavaResourceVisitor
that processes all the found java files. Cannot be null.DirectoryResource savePackage(String packageName, boolean createPackageInfo)
DirectoryResource
returned in
getSourceDirectory()
packageName
- the package name to be createdcreatePackageInfo
- create a package-info.java file under this package?DirectoryResource
with the path for the new packageDirectoryResource saveTestPackage(String packageName, boolean createPackageInfo)
DirectoryResource
returned in
getTestSourceDirectory()
packageName
- the package name to be createdcreatePackageInfo
- create a package-info.java file under this package?DirectoryResource
with the path for the new packageDirectoryResource getPackage(String packageName)
DirectoryResource
returned in
getSourceDirectory()
packageName
- the package name to be createdDirectoryResource
with the package pathDirectoryResource getTestPackage(String packageName)
DirectoryResource
returned in
getTestSourceDirectory()
packageName
- the package name to be createdDirectoryResource
with the package pathCopyright © 2016 JBoss by Red Hat. All rights reserved.