Package org.springframework.aot.generate

# Class FileSystemGeneratedFiles

java.lang.Object
org.springframework.aot.generate.FileSystemGeneratedFiles

All Implemented Interfaces:
  `GeneratedFiles`

public class FileSystemGeneratedFiles extends Object implements GeneratedFiles
`GeneratedFiles` implementation that stores generated files using a `FileSystem`.

Since:
  6.0
Author:
  Phillip Webb, Stephane Nicoll

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.springframework.aot.generate.GeneratedFiles

`GeneratedFiles.FileHandler, GeneratedFiles.Kind`

## Constructor Summary

Constructors
Constructor
Description
`FileSystemGeneratedFiles(Path root)`
Create a new `FileSystemGeneratedFiles` instance with all files stored under the specific `root`.
`FileSystemGeneratedFiles(Function<GeneratedFiles.Kind,Path> roots)`
Create a new `FileSystemGeneratedFiles` instance with all files stored under the root provided by the given `Function`.

## Method Summary

Modifier and Type
Method
Description
`void`
`handleFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<GeneratedFiles.FileHandler> handler)`
Handle a generated file of the specified `GeneratedFiles.Kind` with the given handler.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.aot.generate.GeneratedFiles

`addClassFile, addFile, addFile, addFile, addResourceFile, addResourceFile, addResourceFile, addSourceFile, addSourceFile, addSourceFile, addSourceFile`

## Constructor Details

### FileSystemGeneratedFiles

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` - the root path
See Also:
  - `FileSystemGeneratedFiles(Function)`

### FileSystemGeneratedFiles

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` - a function that returns the root to use for the given `GeneratedFiles.Kind`

## Method Details

### handleFile

public void handleFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<GeneratedFiles.FileHandler> handler)
Description copied from interface: `GeneratedFiles`
Handle a generated file of the specified `GeneratedFiles.Kind` with 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.

Specified by:
  `handleFile` in interface `GeneratedFiles`
Parameters:
  `kind` - the kind of file
  `path` - the relative path of the file
  `handler` - a consumer of a `GeneratedFiles.FileHandler` for the file