Top Description Inners Methods
org.springframework.aot.generate

public Interface GeneratedFiles

Known Direct Implementers
org.springframework.aot.generate.InMemoryGeneratedFiles, org.springframework.aot.generate.FileSystemGeneratedFiles
Imports
org.springframework.core.io.InputStreamSource, org.springframework.javapoet.JavaFile, org.springframework.util.Assert, .ClassUtils, .StringUtils, org.springframework.util.function.ThrowingConsumer

Interface that can be used to add source, resource, or class files generated during ahead-of-time processing. Source and resource files are written using UTF-8 encoding.
Authors
Phillip Webb, Brian Clozel, Stephane Nicoll
Since
6.0
See Also
InMemoryGeneratedFiles, FileSystemGeneratedFiles

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
GeneratedFiles.Kind

The various kinds of generated files that are supported.

Method Summary

Modifier and TypeMethod and Description
public default void
addClassFile(String
the relative path of the file
path
,
InputStreamSource
an InputStreamSource that will provide an input stream containing the file contents
content
)

Add a generated class file with content from the given InputStreamSource.

public default void
addFile(GeneratedFiles.Kind
the kind of file being written
kind
,
String
the relative path of the file
path
,
CharSequence
the contents of the file
content
)

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

public default void
addFile(GeneratedFiles.Kind
the kind of file being written
kind
,
String
the relative path of the file
path
,
ThrowingConsumer<Appendable>
a ThrowingConsumer that accepts an Appendable which will receive the file contents
content
)

Add a generated file of the specified Kind with content written to an Appendable passed to the given ThrowingConsumer.

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
)

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

public default void
addResourceFile(String
the relative path of the file
path
,
CharSequence
the contents of the file
content
)

Add a generated resource file with content from the given CharSequence.

public default void
addResourceFile(String
the relative path of the file
path
,
ThrowingConsumer<Appendable>
a ThrowingConsumer that accepts an Appendable which will receive the file contents
content
)

Add a generated resource file with content written to an Appendable passed to the given ThrowingConsumer.

public default void
addResourceFile(String
the relative path of the file
path
,
InputStreamSource
an InputStreamSource that will provide an input stream containing the file contents
content
)

Add a generated resource file with content from the given InputStreamSource.

public default void
addSourceFile(JavaFile
the java file to add
javaFile
)

Add a generated source file with content from the given JavaFile.

public default void
addSourceFile(String
the class name that should be used to determine the path of the file
className
,
CharSequence
the contents of the file
content
)

Add a generated source file with content from the given CharSequence.

public default void
addSourceFile(String
the class name that should be used to determine the path of the file
className
,
ThrowingConsumer<Appendable>
a ThrowingConsumer that accepts an Appendable which will receive the file contents
content
)

Add a generated source file with content written to an Appendable passed to the given ThrowingConsumer.

public default void
addSourceFile(String
the class name that should be used to determine the path of the file
className
,
InputStreamSource
an InputStreamSource that will provide an input stream containing the file contents
content
)

Add a generated source file with content from the given InputStreamSource.

private static String
private static boolean
private static void
validatePackage(String packageName, String className)

Method Detail

addClassFileback to summary
public default void addClassFile(String path, InputStreamSource content)

Add a generated class file with content from the given InputStreamSource.

Parameters
path:String

the relative path of the file

content:InputStreamSource

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

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

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

Parameters
kind:GeneratedFiles.Kind

the kind of file being written

path:String

the relative path of the file

content:CharSequence

the contents of the file

addFileback to summary
public default void addFile(GeneratedFiles.Kind kind, String path, ThrowingConsumer<Appendable> content)

Add a generated file of the specified Kind with content written to an Appendable passed to the given ThrowingConsumer.

Parameters
kind:GeneratedFiles.Kind

the kind of file being written

path:String

the relative path of the file

content:ThrowingConsumer<Appendable>

a ThrowingConsumer that accepts an Appendable which will receive the file contents

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

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

addResourceFileback to summary
public default void addResourceFile(String path, CharSequence content)

Add a generated resource file with content from the given CharSequence.

Parameters
path:String

the relative path of the file

content:CharSequence

the contents of the file

addResourceFileback to summary
public default void addResourceFile(String path, ThrowingConsumer<Appendable> content)

Add a generated resource file with content written to an Appendable passed to the given ThrowingConsumer.

Parameters
path:String

the relative path of the file

content:ThrowingConsumer<Appendable>

a ThrowingConsumer that accepts an Appendable which will receive the file contents

addResourceFileback to summary
public default void addResourceFile(String path, InputStreamSource content)

Add a generated resource file with content from the given InputStreamSource.

Parameters
path:String

the relative path of the file

content:InputStreamSource

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

addSourceFileback to summary
public default void addSourceFile(JavaFile javaFile)

Add a generated source file with content from the given JavaFile.

Parameters
javaFile:JavaFile

the java file to add

addSourceFileback to summary
public default void addSourceFile(String className, CharSequence content)

Add a generated source file with content from the given CharSequence.

Parameters
className:String

the class name that should be used to determine the path of the file

content:CharSequence

the contents of the file

addSourceFileback to summary
public default void addSourceFile(String className, ThrowingConsumer<Appendable> content)

Add a generated source file with content written to an Appendable passed to the given ThrowingConsumer.

Parameters
className:String

the class name that should be used to determine the path of the file

content:ThrowingConsumer<Appendable>

a ThrowingConsumer that accepts an Appendable which will receive the file contents

addSourceFileback to summary
public default void addSourceFile(String className, InputStreamSource content)

Add a generated source file with content from the given InputStreamSource.

Parameters
className:String

the class name that should be used to determine the path of the file

content:InputStreamSource

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

getClassNamePathback to summary
private static String getClassNamePath(String className)
isJavaIdentifierback to summary
private static boolean isJavaIdentifier(String className)
validatePackageback to summary
private static void validatePackage(String packageName, String className)
org.springframework.aot.generate back to summary

public final Enum GeneratedFiles.Kind

extends Enum<GeneratedFiles.Kind>
Class Inheritance

The various kinds of generated files that are supported.

Field Summary

Modifier and TypeField and Description
public static final GeneratedFiles.Kind
CLASS

A class file containing bytecode.

public static final GeneratedFiles.Kind
RESOURCE

A resource file that should be directly added to the final application.

public static final GeneratedFiles.Kind
SOURCE

A source file containing Java code that should be compiled.

Constructor Summary

AccessConstructor and Description
private
Kind()

Method Summary

Modifier and TypeMethod and Description
public static GeneratedFiles.Kind
public static GeneratedFiles.Kind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLASSback to summary
public static final GeneratedFiles.Kind CLASS

A class file containing bytecode. For example, the result of a proxy generated using CGLIB.

RESOURCEback to summary
public static final GeneratedFiles.Kind RESOURCE

A resource file that should be directly added to the final application. For example, a .properties file.

SOURCEback to summary
public static final GeneratedFiles.Kind SOURCE

A source file containing Java code that should be compiled.

Constructor Detail

Kindback to summary
private Kind()

Method Detail

valueOfback to summary
public static GeneratedFiles.Kind valueOf(String name)
valuesback to summary
public static GeneratedFiles.Kind[] values()