ru.easydonate.easydonate4j.http.client.okhttp.OkHttpClientService Maven / Gradle / Ivy
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