public TypeSpec poetSpec()

in codegen/src/main/java/software/amazon/awssdk/codegen/poet/builder/BaseClientBuilderClass.java [117:223]


    public TypeSpec poetSpec() {
        TypeSpec.Builder builder =
            PoetUtils.createClassBuilder(builderClassName)
                     .addModifiers(Modifier.ABSTRACT)
                     .addAnnotation(SdkInternalApi.class)
                     .addTypeVariable(PoetUtils.createBoundedTypeVariableName("B", builderInterfaceName, "B", "C"))
                     .addTypeVariable(TypeVariableName.get("C"))
                     .superclass(PoetUtils.createParameterizedTypeName(AwsDefaultClientBuilder.class, "B", "C"))
                     .addJavadoc("Internal base class for {@link $T} and {@link $T}.",
                                 ClassName.get(basePackage, model.getMetadata().getSyncBuilder()),
                                 ClassName.get(basePackage, model.getMetadata().getAsyncBuilder()));

        // Only services that require endpoint discovery for at least one of their operations get a default value of
        // 'true'
        if (model.getEndpointOperation().isPresent()) {
            builder.addField(FieldSpec.builder(boolean.class, "endpointDiscoveryEnabled")
                                      .addModifiers(PROTECTED)
                                      .initializer(resolveDefaultEndpointDiscovery() ? "true" : "false")
                                      .build());
        }

        if (authSchemeSpecUtils.useSraAuth()) {
            builder.addField(FieldSpec.builder(ParameterizedTypeName.get(ClassName.get(Map.class),
                                                                         ClassName.get(String.class),
                                                                         GENERIC_AUTH_SCHEME_TYPE),
                                               "additionalAuthSchemes")
                                      .addModifiers(PRIVATE, FINAL)
                                      .initializer("new $T<>()", HashMap.class)
                                      .build());
        }

        builder.addMethod(serviceEndpointPrefixMethod());
        builder.addMethod(serviceNameMethod());
        builder.addMethod(mergeServiceDefaultsMethod());

        mergeInternalDefaultsMethod().ifPresent(builder::addMethod);

        builder.addMethod(finalizeServiceConfigurationMethod());
        if (!authSchemeSpecUtils.useSraAuth()) {
            defaultAwsAuthSignerMethod().ifPresent(builder::addMethod);
        }
        builder.addMethod(signingNameMethod());
        builder.addMethod(defaultEndpointProviderMethod());

        if (authSchemeSpecUtils.useSraAuth()) {
            builder.addMethod(authSchemeProviderMethod());
            builder.addMethod(defaultAuthSchemeProviderMethod());
            builder.addMethod(putAuthSchemeMethod());
            builder.addMethod(authSchemesMethod());
        }

        if (hasRequestAlgorithmMember(model)) {
            builder.addMethod(requestChecksumCalculationMethod());
        }

        if (hasResponseAlgorithms(model)) {
            builder.addMethod(responseChecksumValidationMethod());
        }

        if (hasClientContextParams()) {
            model.getClientContextParams().forEach((n, m) -> {
                builder.addMethod(clientContextParamSetter(n, m));
            });
        }

        if (hasSdkClientContextParams()) {
            model.getCustomizationConfig().getCustomClientContextParams().forEach((n, m) -> {
                builder.addMethod(clientContextParamSetter(n, m));
            });
        }

        endpointParamsKnowledgeIndex.accountIdEndpointModeClassMethodSpec().ifPresent(builder::addMethod);

        if (model.getCustomizationConfig().getServiceConfig().getClassName() != null) {
            builder.addMethod(setServiceConfigurationMethod())
                   .addMethod(beanStyleSetServiceConfigurationMethod());
        }

        if (AuthUtils.usesBearerAuth(model)) {
            builder.addMethod(defaultBearerTokenProviderMethod());
            if (!authSchemeSpecUtils.useSraAuth()) {
                builder.addMethod(defaultTokenAuthSignerMethod());
            }
        }
        addServiceHttpConfigIfNeeded(builder, model);
        builder.addMethod(invokePluginsMethod());
        builder.addMethod(ClientClassUtils.updateRetryStrategyClientConfigurationMethod());
        builder.addMethod(internalPluginsMethod());

        endpointParamsKnowledgeIndex.resolveAccountIdEndpointModeMethod().ifPresent(builder::addMethod);

        if (hasRequestAlgorithmMember(model)) {
            builder.addMethod(resolveRequestChecksumCalculationMethod());
        }

        if (hasResponseAlgorithms(model)) {
            builder.addMethod(resolveResponseChecksumValidationMethod());
        }

        builder.addMethod(validateClientOptionsMethod());

        if (authSchemeSpecUtils.hasSigV4aSupport()) {
            builder.addMethod(sigv4aSigningRegionSetMethod());
        }

        return builder.build();
    }