private void writeToBuilderMethod() {
        writer.writeDocString(writer.format("Creates a builder used to build a {@link $T}.", symbol));
        writer.openBlock("public $T<$T> toBuilder() {",
                "}",
                SmithyBuilder.class,
                symbol,
                () -> {
                    writer.writeInlineWithNoFormatting("return builder()");
                    writer.indent();
                    if (baseShape.hasTrait(TraitDefinition.ID)) {
                        writer.writeInlineWithNoFormatting(".sourceLocation(getSourceLocation())");
                    }
                    if (baseShape.members().isEmpty()) {
                        writer.writeInlineWithNoFormatting(";");
                    }
                    writer.newLine();

                    // Set all builder properties for any members in the shape
                    if (baseShape.isListShape()) {
                        writer.writeWithNoFormatting(".values(getValues());");
                    } else if (baseShape.isMapShape()) {
                        writer.writeWithNoFormatting(".values(values);");
                    } else {
                        Iterator<MemberShape> memberIterator = baseShape.members().iterator();
                        while (memberIterator.hasNext()) {
                            MemberShape member = memberIterator.next();
                            writer.writeInline(".$1L($1L)", symbolProvider.toMemberName(member));
                            if (memberIterator.hasNext()) {
                                writer.writeInlineWithNoFormatting("\n");
                            } else {
                                writer.writeInlineWithNoFormatting(";\n");
                            }
                        }
                    }
                    writer.dedent();
                });
        writer.newLine();
    }
Generates a static builder for a Java class.

<p>In addition to the static builder class, this generator will create
{@code builder()} and {@code toBuilder()} methods for the target class.
smithy-trait-codegen/src/main/java/software/amazon/smithy/traitcodegen/generators/BuilderGenerator.java