Class CodeGenerator
java.lang.Object
org.tquadrat.foundation.config.ap.impl.CodeGenerator
- All Implemented Interfaces:
CodeGeneratorContext
@ClassVersion(sourceVersion="$Id: CodeGenerator.java 1061 2023-09-25 16:32:43Z tquadrat $")
@API(status=STABLE,
since="0.1.0")
public final class CodeGenerator
extends Object
implements CodeGeneratorContext
Generates the code for the new configuration bean.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: CodeGenerator.java 1061 2023-09-25 16:32:43Z tquadrat $
- Since:
- 0.1.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.config.ap.impl.CodeGenerator"
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TypeSpec.Builder
The class builder.private final JavaComposer
The instance ofJavaComposer
that is used for the code generation.private final CodeGenerationConfiguration
The configuration for the generation process.private final MethodSpec.Builder
The builder for the constructor.private final CodeBlock.Builder
The builder for body of the constructor.private static final Map
<SpecialPropertyType, SpecialPropertySpec> The special properties.private final Set
<SuppressableWarnings> The list of the suppressed warnings for the constructor of the new configuration bean. -
Constructor Summary
ConstructorsConstructorDescriptionCodeGenerator
(CodeGenerationConfiguration configuration) Creates a new instance ofCodeGenerator
. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds a warning to the@SuppressWarnings
annotation for the constructor of the new configuration bean.final JavaFile
Generates the code from the configuration provided in the constructor.final TypeSpec.Builder
Provides access to the class builder for the configuration bean.final JavaComposer
Provides access to theJavaComposer
instance that is used for the code generation.Provides access to the configuration.final MethodSpec.Builder
Provides access to the builder for the constructor.final CodeBlock.Builder
Provides access to the code builder for the constructor body.static final SpecialPropertySpec
Returns the definition for the special property type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tquadrat.foundation.config.ap.impl.codebuilders.CodeGeneratorContext
retrieveSpecialPropertySpecification
-
Field Details
-
m_ClassBuilder
The class builder. -
m_Composer
The instance ofJavaComposer
that is used for the code generation. -
m_Configuration
The configuration for the generation process. -
m_Constructor
The builder for the constructor. -
m_ConstructorCode
The builder for body of the constructor. -
m_SuppressedWarningsForConstructor
The list of the suppressed warnings for the constructor of the new configuration bean. -
m_SpecialProperties
The special properties.
-
-
Constructor Details
-
CodeGenerator
Creates a new instance ofCodeGenerator
.- Parameters:
configuration
- The configuration for the generation process.
-
-
Method Details
-
addConstructorSuppressedWarning
Adds a warning to the@SuppressWarnings
annotation for the constructor of the new configuration bean.- Specified by:
addConstructorSuppressedWarning
in interfaceCodeGeneratorContext
- Parameters:
warning
- The warning to suppress.
-
createCode
Generates the code from the configuration provided in the constructor.- Returns:
- The generated code.
-
getClassBuilder
Provides access to the class builder for the configuration bean.- Specified by:
getClassBuilder
in interfaceCodeGeneratorContext
- Returns:
- The reference to the class builder.
-
getComposer
Provides access to theJavaComposer
instance that is used for the code generation.- Specified by:
getComposer
in interfaceCodeGeneratorContext
- Returns:
- The reference for the composer.
-
getConfiguration
Provides access to the configuration.- Specified by:
getConfiguration
in interfaceCodeGeneratorContext
- Returns:
- The configuration.
-
getConstructorBuilder
Provides access to the builder for the constructor.- Specified by:
getConstructorBuilder
in interfaceCodeGeneratorContext
- Returns:
- The reference to the constructor builder.
-
getConstructorCodeBuilder
Provides access to the code builder for the constructor body.- Specified by:
getConstructorCodeBuilder
in interfaceCodeGeneratorContext
- Returns:
- The reference to constructor body code builder.
-
getSpecialPropertySpecification
Returns the definition for the special property type.- Parameters:
type
- The special property type.- Returns:
- The special property specification.
-