Package org.springframework.aot.generate
Interface GeneratedFiles
- All Known Implementing Classes:
FileSystemGeneratedFiles,InMemoryGeneratedFiles
public interface GeneratedFiles
Repository of generated files. Can be used to add
source,
resource, or class files generated
during ahead-of-time processing. Source and resource files are written using
UTF-8 encoding.- Since:
- 6.0
- Author:
- Phillip Webb, Brian Clozel, Stephane Nicoll
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classProvide access to a particular file and offer convenient methods to retrieve, save, or override its content.static enumThe various kinds of generated files that are supported. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddClassFile(String path, InputStreamSource content) Add a generatedclass filewith content from the givenInputStreamSource.default voidaddFile(GeneratedFiles.Kind kind, String path, CharSequence content) Add a generated file of the specifiedGeneratedFiles.Kindwith content from the givenCharSequence.default voidaddFile(GeneratedFiles.Kind kind, String path, InputStreamSource content) Add a generated file of the specifiedGeneratedFiles.Kindwith content from the givenInputStreamSource.default voidaddFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<Appendable> content) Add a generated file of the specifiedGeneratedFiles.Kindwith content written to anAppendablepassed to the givenThrowingConsumer.default voidaddResourceFile(String path, CharSequence content) Add a generatedresource filewith content from the givenCharSequence.default voidaddResourceFile(String path, InputStreamSource content) Add a generatedresource filewith content from the givenInputStreamSource.default voidaddResourceFile(String path, ThrowingConsumer<Appendable> content) Add a generatedresource filewith content written to anAppendablepassed to the givenThrowingConsumer.default voidaddSourceFile(String className, CharSequence content) Add a generatedsource filewith content from the givenCharSequence.default voidaddSourceFile(String className, InputStreamSource content) Add a generatedsource filewith content from the givenInputStreamSource.default voidaddSourceFile(String className, ThrowingConsumer<Appendable> content) Add a generatedsource filewith content written to anAppendablepassed to the givenThrowingConsumer.default voidaddSourceFile(org.springframework.javapoet.JavaFile javaFile) Add a generatedsource filewith content from the givenJavaFile.voidhandleFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<GeneratedFiles.FileHandler> handler) Handle a generated file of the specifiedGeneratedFiles.Kindwith the given handler.
-
Method Details
-
addSourceFile
default void addSourceFile(org.springframework.javapoet.JavaFile javaFile) Add a generatedsource filewith content from the givenJavaFile.- Parameters:
javaFile- the java file to add
-
addSourceFile
Add a generatedsource filewith content from the givenCharSequence.- Parameters:
className- the class name that should be used to determine the path of the filecontent- the contents of the file
-
addSourceFile
Add a generatedsource filewith content written to anAppendablepassed to the givenThrowingConsumer.- Parameters:
className- the class name that should be used to determine the path of the filecontent- aThrowingConsumerthat accepts anAppendablewhich will receive the file contents
-
addSourceFile
Add a generatedsource filewith content from the givenInputStreamSource.- Parameters:
className- the class name that should be used to determine the path of the filecontent- anInputStreamSourcethat will provide an input stream containing the file contents
-
addResourceFile
Add a generatedresource filewith content from the givenCharSequence.- Parameters:
path- the relative path of the filecontent- the contents of the file
-
addResourceFile
Add a generatedresource filewith content written to anAppendablepassed to the givenThrowingConsumer.- Parameters:
path- the relative path of the filecontent- aThrowingConsumerthat accepts anAppendablewhich will receive the file contents
-
addResourceFile
Add a generatedresource filewith content from the givenInputStreamSource.- Parameters:
path- the relative path of the filecontent- anInputStreamSourcethat will provide an input stream containing the file contents
-
addClassFile
Add a generatedclass filewith content from the givenInputStreamSource.- Parameters:
path- the relative path of the filecontent- anInputStreamSourcethat will provide an input stream containing the file contents
-
addFile
Add a generated file of the specifiedGeneratedFiles.Kindwith content from the givenCharSequence.- Parameters:
kind- the kind of file being writtenpath- the relative path of the filecontent- the contents of the file
-
addFile
Add a generated file of the specifiedGeneratedFiles.Kindwith content written to anAppendablepassed to the givenThrowingConsumer.- Parameters:
kind- the kind of file being writtenpath- the relative path of the filecontent- aThrowingConsumerthat accepts anAppendablewhich will receive the file contents
-
addFile
Add a generated file of the specifiedGeneratedFiles.Kindwith content from the givenInputStreamSource.- Parameters:
kind- the kind of file being writtenpath- the relative path of the filecontent- anInputStreamSourcethat will provide an input stream containing the file contents
-
handleFile
void handleFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<GeneratedFiles.FileHandler> handler) Handle a generated file of the specifiedGeneratedFiles.Kindwith the given handler. The file handler lets you consume the content of the already generated file, if any and provide a way to override its content if necessary.- Parameters:
kind- the kind of filepath- the relative path of the filehandler- a consumer of aGeneratedFiles.FileHandlerfor the file- Since:
- 6.2
-