Package org.springframework.aot.generate
Class DefaultGenerationContext
java.lang.Object
org.springframework.aot.generate.DefaultGenerationContext
- All Implemented Interfaces:
GenerationContext
- Direct Known Subclasses:
TestGenerationContext
Default
GenerationContext
implementation.
Generated classes can be flushed out using writeGeneratedContent()
which should be called only once after the generation process using this instance
has completed.
- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll, Sam Brannen
-
Constructor Summary
ConstructorDescriptionDefaultGenerationContext
(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContext
instance backed by the specifiedClassNameGenerator
andGeneratedFiles
.DefaultGenerationContext
(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles, RuntimeHints runtimeHints) Create a newDefaultGenerationContext
instance backed by the specifiedClassNameGenerator
,GeneratedFiles
, andRuntimeHints
. -
Method Summary
Modifier and TypeMethodDescriptionGet theGeneratedClasses
used by the context.Get theGeneratedFiles
used by the context.Get theRuntimeHints
used by the context.Create a newGenerationContext
instance using the specified name to qualify generated assets for a dedicated round of code generation.void
Write any generated content out to the generated files.
-
Constructor Details
-
DefaultGenerationContext
public DefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContext
instance backed by the specifiedClassNameGenerator
andGeneratedFiles
.- Parameters:
classNameGenerator
- the naming convention to use for generated class namesgeneratedFiles
- the generated files
-
DefaultGenerationContext
public DefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles, RuntimeHints runtimeHints) Create a newDefaultGenerationContext
instance backed by the specifiedClassNameGenerator
,GeneratedFiles
, andRuntimeHints
.- Parameters:
classNameGenerator
- the naming convention to use for generated class namesgeneratedFiles
- the generated filesruntimeHints
- the runtime hints
-
-
Method Details
-
getGeneratedClasses
Description copied from interface:GenerationContext
Get theGeneratedClasses
used by the context.All generated classes are written at the end of AOT processing.
- Specified by:
getGeneratedClasses
in interfaceGenerationContext
- Returns:
- the generated classes
-
getGeneratedFiles
Description copied from interface:GenerationContext
Get theGeneratedFiles
used by the context.Used to write resource, java source, or class bytecode files.
- Specified by:
getGeneratedFiles
in interfaceGenerationContext
- Returns:
- the generated files
-
getRuntimeHints
Description copied from interface:GenerationContext
Get theRuntimeHints
used by the context.Used to record reflection, resource, serialization, and proxy hints so that the application can run as a native image.
- Specified by:
getRuntimeHints
in interfaceGenerationContext
- Returns:
- the runtime hints
-
withName
Description copied from interface:GenerationContext
Create a newGenerationContext
instance using the specified name to qualify generated assets for a dedicated round of code generation.If the specified name is already in use, a unique sequence is added to ensure the name is unique.
- Specified by:
withName
in interfaceGenerationContext
- Parameters:
name
- the name to use- Returns:
- a specialized
GenerationContext
for the specified name
-
writeGeneratedContent
public void writeGeneratedContent()Write any generated content out to the generated files.
-