Class SourceStructure
java.lang.Object
io.spring.initializr.generator.language.SourceStructure
Provide dedicated methods for a structure that holds sources.
- Author:
- Stephane Nicoll
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateResourceFile
(String packageName, String file) Create a resource file, creating its package structure if necessary.createSourceFile
(String packageName, String fileName) Create a source file, creating its package structure if necessary.Return the resourcesdirectory
of this structure.Return the rootdirectory
of this structure.Return the sourcesdirectory
of this structure.resolveResourceFile
(String packageName, String file) Resolve a resource file defined in the specified package.resolveSourceFile
(String packageName, String fileName) Resolve a source file.
-
Constructor Details
-
SourceStructure
-
-
Method Details
-
getRootDirectory
Return the rootdirectory
of this structure. Can be used to access additional resources.- Returns:
- the root directory
-
getSourcesDirectory
Return the sourcesdirectory
of this structure.- Returns:
- the sources directory
-
getResourcesDirectory
Return the resourcesdirectory
of this structure.- Returns:
- the resources directory
-
resolveSourceFile
Resolve a source file.- Parameters:
packageName
- the name of the packagefileName
- the name of the file (without its extension)- Returns:
- the
file
to use to store aCompilationUnit
with the specified package and name - See Also:
-
createSourceFile
Create a source file, creating its package structure if necessary.- Parameters:
packageName
- the name of the packagefileName
- the name of the file (without its extension)- Returns:
- the
file
to use to store aCompilationUnit
with the specified package and name - Throws:
IOException
- if an error occurred while trying to create the directory structure or the file itself- See Also:
-
resolveResourceFile
Resolve a resource file defined in the specified package.- Parameters:
packageName
- the name of the packagefile
- the name of the file (including its extension)- Returns:
- the
file
to use to store a resource with the specified package - See Also:
-
createResourceFile
Create a resource file, creating its package structure if necessary.- Parameters:
packageName
- the name of the packagefile
- the name of the file (including its extension)- Returns:
- the
file
to use to store a resource with the specified package - Throws:
IOException
- if an error occurred while trying to create the directory structure or the file itself- See Also:
-