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 SummaryConstructorsModifierConstructorDescriptionDefaultGenerationContext(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 SummaryModifier 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- 
DefaultGenerationContextpublic DefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContextinstance backed by the specifiedClassNameGeneratorandGeneratedFiles.- Parameters:
- classNameGenerator- the naming convention to use for generated class names
- generatedFiles- the generated files
 
- 
DefaultGenerationContextpublic 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 names
- generatedFiles- the generated files
- runtimeHints- the runtime hints
 
- 
DefaultGenerationContextCreate a newDefaultGenerationContextinstance based on the suppliedexistingcontext and feature name.- Parameters:
- existing- the existing context upon which to base the new one
- featureName- the feature name to use
- Since:
- 6.0.12
 
 
- 
- 
Method Details- 
getGeneratedClassesDescription copied from interface:GenerationContextGet theGeneratedClassesused by the context.All generated classes are written at the end of AOT processing. - Specified by:
- getGeneratedClassesin interface- GenerationContext
- Returns:
- the generated classes
 
- 
getGeneratedFilesDescription copied from interface:GenerationContextGet theGeneratedFilesused by the context.Used to write resource, java source, or class bytecode files. - Specified by:
- getGeneratedFilesin interface- GenerationContext
- Returns:
- the generated files
 
- 
getRuntimeHintsDescription 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 interface- GenerationContext
- Returns:
- the runtime hints
 
- 
withNameDescription 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 interface- GenerationContext
- Parameters:
- name- the name to use
- Returns:
- a specialized GenerationContextfor the specified name
 
- 
writeGeneratedContentpublic void writeGeneratedContent()Write any generated content out to the generated files.
 
-