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
ConstructorsModifierConstructorDescriptionDefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContextinstance backed by the specifiedClassNameGeneratorandGeneratedFiles.DefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles, RuntimeHints runtimeHints) Create a newDefaultGenerationContextinstance backed by the specifiedClassNameGenerator,GeneratedFiles, andRuntimeHints.protectedDefaultGenerationContext(DefaultGenerationContext existing, String featureName) Create a newDefaultGenerationContextinstance based on the suppliedexistingcontext and feature name. -
Method Summary
Modifier and TypeMethodDescriptionGet theGeneratedClassesused by the context.Get theGeneratedFilesused by the context.Get theRuntimeHintsused by the context.Create a newGenerationContextinstance using the specified name to qualify generated assets for a dedicated round of code generation.voidWrite any generated content out to the generated files.
-
Constructor Details
-
DefaultGenerationContext
public DefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContextinstance backed by the specifiedClassNameGeneratorandGeneratedFiles.- 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 newDefaultGenerationContextinstance backed by the specifiedClassNameGenerator,GeneratedFiles, andRuntimeHints.- Parameters:
classNameGenerator- the naming convention to use for generated class namesgeneratedFiles- the generated filesruntimeHints- the runtime hints
-
DefaultGenerationContext
Create a newDefaultGenerationContextinstance based on the suppliedexistingcontext and feature name.- Parameters:
existing- the existing context upon which to base the new onefeatureName- the feature name to use- Since:
- 6.0.12
-
-
Method Details
-
getGeneratedClasses
Description copied from interface:GenerationContextGet theGeneratedClassesused by the context.All generated classes are written at the end of AOT processing.
- Specified by:
getGeneratedClassesin interfaceGenerationContext- Returns:
- the generated classes
-
getGeneratedFiles
Description copied from interface:GenerationContextGet theGeneratedFilesused by the context.Used to write resource, java source, or class bytecode files.
- Specified by:
getGeneratedFilesin interfaceGenerationContext- Returns:
- the generated files
-
getRuntimeHints
Description copied from interface:GenerationContextGet theRuntimeHintsused by the context.Used to record reflection, resource, serialization, and proxy hints so that the application can run as a native image.
- Specified by:
getRuntimeHintsin interfaceGenerationContext- Returns:
- the runtime hints
-
withName
Description copied from interface:GenerationContextCreate a newGenerationContextinstance 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:
withNamein interfaceGenerationContext- Parameters:
name- the name to use- Returns:
- a specialized
GenerationContextfor the specified name
-
writeGeneratedContent
public void writeGeneratedContent()Write any generated content out to the generated files.
-