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 resourcesdirectoryof this structure.Return the rootdirectoryof this structure.Return the sourcesdirectoryof 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 rootdirectoryof this structure. Can be used to access additional resources.- Returns:
- the root directory
-
getSourcesDirectory
Return the sourcesdirectoryof this structure.- Returns:
- the sources directory
-
getResourcesDirectory
Return the resourcesdirectoryof 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
fileto use to store aCompilationUnitwith 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
fileto use to store aCompilationUnitwith 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
fileto 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
fileto 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:
-