private void ensureSaneDefaults() { if (converter == null) { converter = Platform.get().defaultConverter(); } if (clientProvider == null) { clientProvider = Platform.get().defaultClient(); } if (httpExecutor == null) { httpExecutor = Platform.get().defaultHttpExecutor(); } if (callbackExecutor == null) { callbackExecutor = Platform.get().defaultCallbackExecutor(); } if (headers == null) { headers = Headers.NONE; } }
private void eagerlyValidateMethods(Class<?> service) { Platform platform = Platform.get(); for (Method method : service.getDeclaredMethods()) { if (!platform.isDefaultMethod(method)) { loadMethodHandler(method); } } }
@Override void getKnown(URI uri) { long[] ticks; synchronized (this) { ticks = _ticks != null ? Platform.get().clone(_ticks) : null; } if (ticks == null && !location().isCache()) ticks = Tick.EMPTY; if (ticks != null) uri.onKnown(this, ticks); }
/** Create the {@link Retrofit} instances. */ public Retrofit build() { if (baseUrl == null) { throw new IllegalStateException("Base URL required."); } OkHttpClient client = this.client; if (client == null) { client = new OkHttpClient(); } // Make a defensive copy of the adapters and add the default Call adapter. List<CallAdapter.Factory> adapterFactories = new ArrayList<>(this.adapterFactories); adapterFactories.add(Platform.get().defaultCallAdapterFactory(callbackExecutor)); // Make a defensive copy of the converters. List<Converter.Factory> converterFactories = new ArrayList<>(this.converterFactories); return new Retrofit( client, baseUrl, converterFactories, adapterFactories, callbackExecutor, validateEagerly); }