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

ru.easydonate.easydonate4j.http.client.okhttp.OkHttpClientService Maven / Gradle / Ivy

There is a newer version: 2.0.6
Show newest version
package ru.easydonate.easydonate4j.http.client.okhttp;

import org.jetbrains.annotations.NotNull;
import ru.easydonate.easydonate4j.http.client.HttpClient;
import ru.easydonate.easydonate4j.http.client.HttpClientService;
import ru.easydonate.easydonate4j.http.client.HttpClientServiceType;
import ru.easydonate.easydonate4j.module.ModuleAlreadyRegisteredException;
import ru.easydonate.easydonate4j.module.ModuleRegistrator;
import ru.easydonate.easydonate4j.module.ModuleType;

public final class OkHttpClientService implements HttpClientService {

    public static void register() {
        if(isRegistered())
            throw new ModuleAlreadyRegisteredException(ModuleType.HTTP_CLIENT_SERVICE);

        ModuleRegistrator.get().registerHttpClientService(new OkHttpClientService());
    }

    public static boolean isRegistered() {
        return ModuleRegistrator.httpClientServiceRegistered(OkHttpClientService.class);
    }

    @Override
    public @NotNull HttpClientServiceType getType() {
        return HttpClientServiceType.OKHTTP;
    }

    @Override
    public @NotNull HttpClient.Builder buildClient() {
        return new OkHttpClientBuilder();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy