Package org.springframework.aot.generate

# Class InMemoryGeneratedFiles

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

All Implemented Interfaces:
  `GeneratedFiles`

public class InMemoryGeneratedFiles extends Object implements GeneratedFiles
`GeneratedFiles` implementation that keeps generated files in-memory.

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
`InMemoryGeneratedFiles()`

## Method Summary

Modifier and Type
Method
Description
`InputStreamSource`
`getGeneratedFile(GeneratedFiles.Kind kind, String path)`
Return the `InputStreamSource` of specified file.
`String`
`getGeneratedFileContent(GeneratedFiles.Kind kind, String path)`
Return the content of the specified file.
`Map<String,InputStreamSource>`
`getGeneratedFiles(GeneratedFiles.Kind kind)`
Return a `Map` of the generated files of a specific `GeneratedFiles.Kind`.
`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

### InMemoryGeneratedFiles

public InMemoryGeneratedFiles()

## 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

### getGeneratedFiles

public Map<String,InputStreamSource> getGeneratedFiles(GeneratedFiles.Kind kind)
Return a `Map` of the generated files of a specific `GeneratedFiles.Kind`.

Parameters:
  `kind` - the kind of generated file
Returns:
  a `Map` of paths to `InputStreamSource` instances

### getGeneratedFileContent

@Nullable public String getGeneratedFileContent(GeneratedFiles.Kind kind, String path) throws IOException
Return the content of the specified file.

Parameters:
  `kind` - the kind of generated file
  `path` - the path of the file
Returns:
  the file content or `null` if no file could be found
Throws:
  `IOException` - on read error

### getGeneratedFile

@Nullable public InputStreamSource getGeneratedFile(GeneratedFiles.Kind kind, String path)
Return the `InputStreamSource` of specified file.

Parameters:
  `kind` - the kind of generated file
  `path` - the path of the file
Returns:
  the file source or `null` if no file could be found