Forge - Shell API 1.2.0.Final

org.jboss.forge.project.facets
Interface JavaSourceFacet

All Superinterfaces:
Facet

public interface JavaSourceFacet
extends Facet

Author:
Lincoln Baxter, III

Method Summary
 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()
          Return the base Java Package for this project, returned as a String
 DirectoryResource getBasePackageResource()
          Return the base Java Package for this project, returned as a directory File
 JavaResource getEnumTypeResource(JavaEnum javaEnum)
          Attempt to locate and re-parse the given JavaEnum from its location on disk, relative to getSourceFolder().
 JavaResource getEnumTypeResource(String relativePath)
          Return the JavaEnum at the given path relative to getSourceFolder().
 JavaResource getJavaResource(JavaSource<?> javaClass)
          Attempt to locate and re-parse the given JavaClass from its location on disk, relative to getSourceFolder().
 JavaResource getJavaResource(String relativePath)
          Return the JavaClass at the given path relative to getSourceFolder().
 DirectoryResource getSourceFolder()
          Get the DirectoryResource this Project uses to store package-able source documents (such as .java files.)
 List<DirectoryResource> getSourceFolders()
          Get a list of DirectoryResources this project uses to contain Project source documents (such as .java files.)
 JavaResource getTestJavaResource(JavaSource<?> javaClass)
          Attempt to locate and re-parse the given JavaClass from its location on disk, relative to getTestSourceFolder().
 JavaResource getTestJavaResource(String relativePath)
          Return the JavaClass at the given path relative to getTestSourceFolder().
 DirectoryResource getTestSourceFolder()
          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 saveEnumTypeSource(JavaEnum source)
          Create or update a Java file in the primary source directory: getSourceFolder() - use information in the given JavaEnum to determine the appropriate package; packages will be created if necessary.
 JavaResource saveJavaSource(JavaSource<?> source)
          Create or update a Java file in the primary source directory: getSourceFolder() - use information in the given JavaSource to determine the appropriate package; packages will be created if necessary.
 JavaResource saveTestJavaSource(JavaSource<?> source)
          Create or update a Java file in the primary test source directory: getTestSourceFolder() - use information in the given JavaSource to determine the appropriate package; packages will be created if necessary.
 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.
 
Methods inherited from interface org.jboss.forge.project.Facet
getProject, install, isInstalled, setProject, uninstall
 

Method Detail

calculateName

String calculateName(JavaResource resource)
Return the class name for the given JavaResource whether it exists or not.


calculatePackage

String calculatePackage(JavaResource resource)
Return the package for the given JavaResource whether it exists or not.


getBasePackage

String getBasePackage()
Return the base Java Package for this project, returned as a String


getBasePackageResource

DirectoryResource getBasePackageResource()
Return the base Java Package for this project, returned as a directory File


getSourceFolders

List<DirectoryResource> getSourceFolders()
Get a list of DirectoryResources this project uses to contain Project source documents (such as .java files.)


getSourceFolder

DirectoryResource getSourceFolder()
Get the DirectoryResource this Project uses to store package-able source documents (such as .java files.)


getTestSourceFolder

DirectoryResource getTestSourceFolder()
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.


saveJavaSource

JavaResource saveJavaSource(JavaSource<?> source)
                            throws FileNotFoundException
Create or update a Java file in the primary source directory: getSourceFolder() - use information in the given JavaSource to determine the appropriate package; packages will be created if necessary.

Parameters:
source - The java class to create
Returns:
The created or updated JavaResource
Throws:
FileNotFoundException

saveEnumTypeSource

JavaResource saveEnumTypeSource(JavaEnum source)
                                throws FileNotFoundException
Create or update a Java file in the primary source directory: getSourceFolder() - use information in the given JavaEnum to determine the appropriate package; packages will be created if necessary.

Parameters:
source - The java enum type to create
Returns:
The created or updated EnumTypeResource
Throws:
FileNotFoundException

saveTestJavaSource

JavaResource saveTestJavaSource(JavaSource<?> source)
                                throws FileNotFoundException
Create or update a Java file in the primary test source directory: getTestSourceFolder() - use information in the given JavaSource to determine the appropriate package; packages will be created if necessary.

Parameters:
source - The java class to create
Returns:
The created or updated JavaResource
Throws:
FileNotFoundException

getJavaResource

JavaResource getJavaResource(String relativePath)
                             throws FileNotFoundException
Return the JavaClass at the given path relative to getSourceFolder().

Parameters:
relativePath - The file or package path of the target Java source file.
Throws:
FileNotFoundException - if the target JavaResource does not exist

getJavaResource

JavaResource getJavaResource(JavaSource<?> javaClass)
                             throws FileNotFoundException
Attempt to locate and re-parse the given JavaClass from its location on disk, relative to getSourceFolder(). The given instance will not be modified, and a new instance will be returned.

Parameters:
javaClass - The JavaClass to re-parse.
Throws:
FileNotFoundException - if the target JavaResource does not exist

getEnumTypeResource

JavaResource getEnumTypeResource(String relativePath)
                                 throws FileNotFoundException
Return the JavaEnum at the given path relative to getSourceFolder().

Parameters:
relativePath - The file or package path of the target Java source file.
Throws:
FileNotFoundException - if the target JavaResource does not exist

getEnumTypeResource

JavaResource getEnumTypeResource(JavaEnum javaEnum)
                                 throws FileNotFoundException
Attempt to locate and re-parse the given JavaEnum from its location on disk, relative to getSourceFolder(). The given instance will not be modified, and a new instance will be returned.

Parameters:
javaClass - The JavaClass to re-parse.
Throws:
FileNotFoundException - if the target JavaResource does not exist

getTestJavaResource

JavaResource getTestJavaResource(String relativePath)
                                 throws FileNotFoundException
Return the JavaClass at the given path relative to getTestSourceFolder().

Parameters:
relativePath - The package path of the target Java source JavaResource.
Throws:
FileNotFoundException

getTestJavaResource

JavaResource getTestJavaResource(JavaSource<?> javaClass)
                                 throws FileNotFoundException
Attempt to locate and re-parse the given JavaClass from its location on disk, relative to getTestSourceFolder(). The given instance will not be modified, and a new instance will be returned.

Parameters:
javaClass - The JavaClass to re-parse.
Throws:
FileNotFoundException - if the target JavaResource does not exist

visitJavaSources

void visitJavaSources(JavaResourceVisitor visitor)
Recursively loops over all the source directories and for each java file it finds, calls the visitor.

Parameters:
visitor - The JavaResourceVisitor that processes all the found java files. Cannot be null.

visitJavaTestSources

void visitJavaTestSources(JavaResourceVisitor visitor)
Recursively loops over all the test source directories and for each java file it finds, calls the visitor.

Parameters:
visitor - The JavaResourceVisitor that processes all the found java files. Cannot be null.

Forge - Shell API 1.2.0.Final

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.