Package org.springframework.aot.generate
Class DefaultGenerationContext
java.lang.Object
org.springframework.aot.generate.DefaultGenerationContext
- All Implemented Interfaces:
GenerationContext
Default
GenerationContext implementation.- Since:
- 6.0
- Author:
- Phillip Webb, Stephane Nicoll
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultGenerationContext(ClassNameGenerator classNameGenerator, GeneratedFiles generatedFiles) Create a newDefaultGenerationContextinstance backed by the specifiedClassNameGeneratorandGeneratedFiles.DefaultGenerationContext(GeneratedClasses generatedClasses, GeneratedFiles generatedFiles, RuntimeHints runtimeHints) Create a newDefaultGenerationContextinstance backed by the specified items. -
Method Summary
Modifier and TypeMethodDescriptionReturn theGeneratedClassesbeing used by the context.Return theGeneratedFilesbeing used by the context.Return theRuntimeHintsbeing used by the context.Return 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(GeneratedClasses generatedClasses, GeneratedFiles generatedFiles, RuntimeHints runtimeHints) Create a newDefaultGenerationContextinstance backed by the specified items.- Parameters:
generatedClasses- the generated classesgeneratedFiles- the generated filesruntimeHints- the runtime hints
-
-
Method Details
-
getGeneratedClasses
Description copied from interface:GenerationContextReturn theGeneratedClassesbeing used by the context. Allows a single generated class to be shared across multiple AOT processors. All generated classes are written at the end of AOT processing.- Specified by:
getGeneratedClassesin interfaceGenerationContext- Returns:
- the generated classes
-
getGeneratedFiles
Description copied from interface:GenerationContextReturn theGeneratedFilesbeing used 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:GenerationContextReturn theRuntimeHintsbeing used by the context. Used to recordreflection,resource,serializationandproxyhints so that the application can run as a native image.- Specified by:
getRuntimeHintsin interfaceGenerationContext- Returns:
- the runtime hints
-
withName
Description copied from interface:GenerationContextReturn a newGenerationContextinstance using the specified name to qualify generated assets for a dedicated round of code generation. If this 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.
-