public void run() {
        // Check that all required fields have been correctly initialized.
        Objects.requireNonNull(integrations, "`integrations` not initialized.");
        Objects.requireNonNull(codegenContext, "`codegenContext` not initialized.");

        // Find all trait definition shapes excluding traits in the prelude.
        LOGGER.info("Generating trait classes.");
        Set<Shape> traitClosure = getTraitClosure(codegenContext.model());
        for (Shape trait : traitClosure) {
            new ShapeGenerator().accept(new GenerateTraitDirective(codegenContext, trait));
        }

        LOGGER.info("Flushing writers");
        // Flush all writers
        if (!codegenContext.writerDelegator().getWriters().isEmpty()) {
            codegenContext.writerDelegator().flushWriters();
        }
    }
Orchestration class for Trait code generation.

<p>Trait codegen executes the following steps:
<ul>
    <li>Orchestrator creation - Plugin creates an instance of {@link TraitCodegen}.</li>
    <li>Initialization - {@link #initialize()} is called to discover integration, filter out
    any shapes with excluded tags, and set up the codegen context.</li>
    <li>Execution - {@link #run()} is called to build a list of shapes to generate by pulling
    all shapes with the {@link TraitDefinition} trait applied and walking the nested shapes inside
    of those trait shapes. Then the {@link ShapeGenerator} is applied to each of the shapes to
    generate. Finally, all of the writers created during the shapes generation process are flushed.</li>
</ul>
smithy-trait-codegen/src/main/java/software/amazon/smithy/traitcodegen/TraitCodegen.java