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
ConstructorsModifierConstructorDescriptionprotectedFileHandler(boolean exists, Supplier<InputStreamSource> existingContent) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcopy(InputStreamSource content, boolean override) voidcreate(InputStreamSource content) Create a file with the given content.booleanexists()Specify whether the file already exists.Return anInputStreamSourcefor the content of the file ornullif the file does not exist.voidoverride(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:
trueif the file already exists
-
getContent
Return anInputStreamSourcefor the content of the file ornullif 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
-