Top Description Fields Constructors Methods
org.springframework.aot.generate

public Class FileSystemGeneratedFiles

extends Object
implements GeneratedFiles
Class Inheritance
All Implemented Interfaces
org.springframework.aot.generate.GeneratedFiles
Imports
java.io.IOException, .InputStream, java.nio.file.FileSystem, .Files, .Path, java.util.Arrays, .Objects, java.util.function.Function, org.springframework.core.io.InputStreamSource, org.springframework.util.Assert

GeneratedFiles implementation that stores generated files using a FileSystem.
Author
Phillip Webb
Since
6.0

Field Summary

Modifier and TypeField and Description
private final Function<GeneratedFiles.Kind, Path>

Constructor Summary

AccessConstructor and Description
public
FileSystemGeneratedFiles(Path
the root path
root
)

Create a new FileSystemGeneratedFiles instance with all files stored under the specific root.

public
FileSystemGeneratedFiles(Function<GeneratedFiles.Kind, Path>
a function that returns the root to use for the given Kind
roots
)

Create a new FileSystemGeneratedFiles instance with all files stored under the root provided by the given Function.

Method Summary

Modifier and TypeMethod and Description
public void
addFile(GeneratedFiles.Kind
the kind of file being written
kind
,
String
the relative path of the file
path
,
InputStreamSource
an InputStreamSource that will provide an input stream containing the file contents
content
)

Implements org.springframework.aot.generate.GeneratedFiles.addFile.

Add a generated file of the specified Kind with content from the given InputStreamSource.
private static Function<GeneratedFiles.Kind, Path>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rootsback to summary
private final Function<GeneratedFiles.Kind, Path> roots

Constructor Detail

FileSystemGeneratedFilesback to summary
public FileSystemGeneratedFiles(Path root)

Create a new FileSystemGeneratedFiles instance with all files stored under the specific root. The following subdirectories are created for the different file kinds:

  • sources
  • resources
  • classes
Parameters
root:Path

the root path

See Also
FileSystemGeneratedFiles(Function)
FileSystemGeneratedFilesback to summary
public FileSystemGeneratedFiles(Function<GeneratedFiles.Kind, Path> roots)

Create a new FileSystemGeneratedFiles instance with all files stored under the root provided by the given Function.

Parameters
roots:Function<GeneratedFiles.Kind, Path>

a function that returns the root to use for the given Kind

Method Detail

addFileback to summary
public void addFile(GeneratedFiles.Kind kind, String path, InputStreamSource content)

Implements org.springframework.aot.generate.GeneratedFiles.addFile.

Doc from org.springframework.aot.generate.GeneratedFiles.addFile.

Add a generated file of the specified Kind with content from the given InputStreamSource.

Parameters
kind:GeneratedFiles.Kind

the kind of file being written

path:String

the relative path of the file

content:InputStreamSource

an InputStreamSource that will provide an input stream containing the file contents

Annotations
@Override
conventionRootsback to summary
private static Function<GeneratedFiles.Kind, Path> conventionRoots(Path root)