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

public Class InMemoryGeneratedFiles

extends Object
implements GeneratedFiles
Class Inheritance
All Implemented Interfaces
org.springframework.aot.generate.GeneratedFiles
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.Collections, .HashMap, .LinkedHashMap, .Map, org.springframework.core.io.InputStreamSource, org.springframework.lang.Nullable, org.springframework.util.Assert

GeneratedFiles implementation that keeps generated files in-memory.
Author
Phillip Webb
Since
6.0

Field Summary

Modifier and TypeField and Description
private final Map<GeneratedFiles.Kind, Map<String, InputStreamSource>>

Constructor Summary

AccessConstructor and Description
public

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.

public InputStreamSource

Returns:

the file source or null if no file could be found
getGeneratedFile
(GeneratedFiles.Kind
the kind of generated file
kind
,
String
the path of the file
path
)

Return the InputStreamSource of specified file.

public String

Returns:

the file content or null if no file could be found
getGeneratedFileContent
(GeneratedFiles.Kind
the kind of generated file
kind
,
String
the path of the file
path
)

Return the content of the specified file.

public Map<String, InputStreamSource>

Returns:

a Map of paths to InputStreamSource instances
getGeneratedFiles
(GeneratedFiles.Kind
the kind of generated file
kind
)

Return a Map of the generated files of a specific Kind.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

filesback to summary
private final Map<GeneratedFiles.Kind, Map<String, InputStreamSource>> files

Constructor Detail

InMemoryGeneratedFilesback to summary
public InMemoryGeneratedFiles()

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
getGeneratedFileback to summary
public InputStreamSource getGeneratedFile(GeneratedFiles.Kind kind, String path)

Return the InputStreamSource of specified file.

Parameters
kind:GeneratedFiles.Kind

the kind of generated file

path:String

the path of the file

Returns:InputStreamSource

the file source or null if no file could be found

Annotations
@Nullable
getGeneratedFileContentback to summary
public String getGeneratedFileContent(GeneratedFiles.Kind kind, String path) throws IOException

Return the content of the specified file.

Parameters
kind:GeneratedFiles.Kind

the kind of generated file

path:String

the path of the file

Returns:String

the file content or null if no file could be found

Annotations
@Nullable
Exceptions
IOException:
on read error
getGeneratedFilesback to summary
public Map<String, InputStreamSource> getGeneratedFiles(GeneratedFiles.Kind kind)

Return a Map of the generated files of a specific Kind.

Parameters
kind:GeneratedFiles.Kind

the kind of generated file

Returns:Map<String, InputStreamSource>

a Map of paths to InputStreamSource instances