I would like to be able to enforce different `httpClient` setups and `credentialsProvider` for all service clients created in our AWS backend. To do this I wanted to use Java Generics.

Whenever somone creates a new service client I would like to use it like this:

```
    S3Client s3client = setupAwsClient(S3Client.builder())
            .region(Region.EU_WEST_1)
            .build();

```

My NOT compiling impl of `setupAwsClient` looks like this:

```
public <T extends AwsSyncClientBuilder<SdkSyncClientBuilder<...>, SdkClient> & BaseClientBuilder<S3ClientBuilder, SdkClient> T setupAwsClient(T client) {

    return client
            .credentialsProvider(credentialsProvider)
            .httpClient(awsBaseClient);
}

```

The problem is that there are so many interfaces I have to specify that the functions looks like a mess.

My question is: What would be the clean way to enforce some setup among all service clients in the AWS SDK? Is generics a good solution or are there better ways?

UPDATE:

```
public <T extends AwsSyncClientBuilder<?,?> & AwsClientBuilder<?, ?>> T setup(T clientBuilder) {

}

```

Trying this is not working either. Even that `AwsClientBuilder` provides `credentialsProvider` and `AwsSyncClientBuilder` provides `httpClient`.