All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.bmc.streaming.StreamAsyncClientBuilder Maven / Gradle / Ivy

There is a newer version: 3.49.0
Show newest version
/**
 * Copyright (c) 2016, 2024, Oracle and/or its affiliates.  All rights reserved.
 * This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
 */
package com.oracle.bmc.streaming;

import com.oracle.bmc.Service;
import com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider;

import jakarta.annotation.Nonnull;

public class StreamAsyncClientBuilder
        extends AbstractStreamBasedClientBuilder {
    public StreamAsyncClientBuilder(Service service) {
        super(service);
    }

    @Override
    public StreamAsyncClient build(
            @Nonnull AbstractAuthenticationDetailsProvider authenticationDetailsProvider) {
        if (authenticationDetailsProvider == null) {
            throw new NullPointerException(
                    "authenticationDetailsProvider is marked non-null but is null");
        }

        String streamEndpoint = getEndpoint();

        // We create a copy of the builder and set the endpoint there, this way we don't modify this
        // builder
        // Otherwise, we might have both endpoint and stream or streamSummary set, which would cause
        // an exception to be thrown in getEndpoint(), if this builder were used a second time.
        StreamAsyncClientBuilder copy =
                StreamAsyncClient.builder().copyFrom(this).endpoint(streamEndpoint);

        return new StreamAsyncClient(copy, authenticationDetailsProvider);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy