Package org.springframework.aot.generate
Class GeneratedFiles.FileHandler
java.lang.Object
org.springframework.aot.generate.GeneratedFiles.FileHandler
- Enclosing interface:
- GeneratedFiles
Provide access to a particular file and offer convenient methods to retrieve,
save, or override its content.
- Since:
- 6.2
-
Constructor Summary
ModifierConstructorDescriptionprotected
FileHandler
(boolean exists, Supplier<InputStreamSource> existingContent) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
copy
(InputStreamSource content, boolean override) void
create
(InputStreamSource content) Create a file with the given content.boolean
exists()
Specify whether the file already exists.Return anInputStreamSource
for the content of the file ornull
if the file does not exist.void
override
(InputStreamSource content) Override the content of the file handled by this instance using the given content.
-
Constructor Details
-
FileHandler
-
-
Method Details
-
exists
public boolean exists()Specify whether the file already exists.- Returns:
true
if the file already exists
-
getContent
Return anInputStreamSource
for the content of the file ornull
if the file does not exist. -
create
Create a file with the given content.- Throws:
IllegalStateException
- if the file already exists
-
override
Override the content of the file handled by this instance using the given content. If the file does not exist, it is created. -
copy
-