本文整理了Java中com.apollographql.apollo.api.internal.Utils
类的一些代码示例,展示了Utils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils
类的具体详情如下:
包路径:com.apollographql.apollo.api.internal.Utils
类名称:Utils
[英]Contains utility methods for checking Preconditions
[中]包含用于检查前提条件的实用方法
代码示例来源:origin: apollographql/apollo-android
/**
* @param evictionPolicy {@link EvictionPolicy} to manage the primary cache.
*/
public LruNormalizedCacheFactory(EvictionPolicy evictionPolicy) {
this.evictionPolicy = checkNotNull(evictionPolicy, "evictionPolicy == null");
}
代码示例来源:origin: apollographql/apollo-android
@Override public void onCacheRecordsChanged(Set<String> changedRecordKeys) {
if (dependentKeys.isEmpty() || !Utils.areDisjoint(dependentKeys, changedRecordKeys)) {
refetch();
}
}
};
代码示例来源:origin: apollographql/apollo-android
@SuppressWarnings("unchecked") // safe covariant cast
@Override
public Optional<T> or(Optional<? extends T> secondChoice) {
return (Optional<T>) checkNotNull(secondChoice);
}
代码示例来源:origin: apollographql/apollo-android
@Override public T or(T defaultValue) {
checkNotNull(defaultValue, "use Optional.orNull() instead of Optional.or(null)");
return reference;
}
代码示例来源:origin: apollographql/apollo-android
/**
* <p>Set the API server's base url.</p>
*
* @param serverUrl the url to set.
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder serverUrl(@NotNull HttpUrl serverUrl) {
this.serverUrl = checkNotNull(serverUrl, "serverUrl is null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
/**
* Sets the http cache policy to be used as default for all GraphQL {@link Query} operations. Will be ignored for
* any {@link Mutation} operations. By default http cache policy is set to {@link HttpCachePolicy#NETWORK_ONLY}.
*
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder defaultHttpCachePolicy(@NotNull HttpCachePolicy.Policy cachePolicy) {
this.defaultHttpCachePolicy = checkNotNull(cachePolicy, "cachePolicy == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
/**
* Set the default {@link CacheHeaders} strategy that will be passed to the {@link
* com.apollographql.apollo.interceptor.FetchOptions} used in each new {@link ApolloCall}.
*
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder defaultCacheHeaders(@NotNull CacheHeaders cacheHeaders) {
this.defaultCacheHeaders = checkNotNull(cacheHeaders, "cacheHeaders == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
/**
* Set the default {@link ResponseFetcher} to be used with each new {@link ApolloCall}.
*
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder defaultResponseFetcher(@NotNull ResponseFetcher defaultResponseFetcher) {
this.defaultResponseFetcher = checkNotNull(defaultResponseFetcher, "defaultResponseFetcher == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
@Override
public String apply(Object o) {
checkNotNull(o); // eager for GWT.
return o.toString();
}
代码示例来源:origin: apollographql/apollo-android
public Start(@NotNull String subscriptionId, @NotNull Subscription<?, ?, ?> subscription,
@NotNull ScalarTypeAdapters scalarTypeAdapters) {
this.subscriptionId = checkNotNull(subscriptionId, "subscriptionId == null");
this.subscription = checkNotNull(subscription, "subscription == null");
this.scalarTypeAdapters = checkNotNull(scalarTypeAdapters, "scalarTypeAdapters == null");
}
代码示例来源:origin: apollographql/apollo-android
/**
* Set the custom call factory for creating {@link Call} instances. <p> Note: Calling {@link
* #okHttpClient(OkHttpClient)} automatically sets this value.
*/
public Builder callFactory(@NotNull Call.Factory factory) {
this.callFactory = checkNotNull(factory, "factory == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
/**
* Set the configuration to be used for request/response http cache.
*
* @param httpCache The to use for reading and writing cached response.
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder httpCache(@NotNull HttpCache httpCache) {
this.httpCache = checkNotNull(httpCache, "httpCache == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
public ApolloCacheInterceptor(@NotNull ApolloStore apolloStore, @NotNull ResponseFieldMapper responseFieldMapper,
@NotNull Executor dispatcher, @NotNull ApolloLogger logger) {
this.apolloStore = checkNotNull(apolloStore, "cache == null");
this.responseFieldMapper = checkNotNull(responseFieldMapper, "responseFieldMapper == null");
this.dispatcher = checkNotNull(dispatcher, "dispatcher == null");
this.logger = checkNotNull(logger, "logger == null");
}
代码示例来源:origin: apollographql/apollo-android
/**
* The #{@link Executor} to use for dispatching the requests.
*
* @return The {@link Builder} object to be used for chaining method calls
*/
public Builder dispatcher(@NotNull Executor dispatcher) {
this.dispatcher = checkNotNull(dispatcher, "dispatcher == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
public Builder cacheHeaders(@NotNull CacheHeaders cacheHeaders) {
this.cacheHeaders = checkNotNull(cacheHeaders, "cacheHeaders == null");
return this;
}
代码示例来源:origin: apollographql/apollo-android
@Override @NotNull public <F extends GraphqlFragment> ApolloStoreOperation<F> read(
@NotNull final ResponseFieldMapper<F> responseFieldMapper, @NotNull final CacheKey cacheKey,
@NotNull final Operation.Variables variables) {
checkNotNull(responseFieldMapper, "responseFieldMapper == null");
checkNotNull(cacheKey, "cacheKey == null");
checkNotNull(variables, "variables == null");
return new ApolloStoreOperation<F>(dispatcher) {
@Override protected F perform() {
return doRead(responseFieldMapper, cacheKey, variables);
}
};
}
代码示例来源:origin: apollographql/apollo-android
@Override
public <T> void subscribe(@NotNull final Subscription<?, T, ?> subscription,
@NotNull final SubscriptionManager.Callback<T> callback) {
checkNotNull(subscription, "subscription == null");
checkNotNull(callback, "callback == null");
dispatcher.execute(new Runnable() {
@Override
public void run() {
doSubscribe(subscription, callback);
}
});
}
代码示例来源:origin: apollographql/apollo-android
@Override @NotNull public <D extends Operation.Data, T, V extends Operation.Variables>
ApolloStoreOperation<Set<String>> write(@NotNull final Operation<D, T, V> operation, @NotNull final D operationData) {
checkNotNull(operation, "operation == null");
checkNotNull(operationData, "operationData == null");
return new ApolloStoreOperation<Set<String>>(dispatcher) {
@Override protected Set<String> perform() {
return doWrite(operation, operationData, false, null);
}
};
}
代码示例来源:origin: apollographql/apollo-android
@Override public <V> Optional<V> flatMap(Function<? super T, Optional<V>> function) {
checkNotNull(function);
return checkNotNull(function.apply(reference),
"the Function passed to Optional.flatMap() must not return null.");
}
代码示例来源:origin: apollographql/apollo-android
@Override
public void unsubscribe(@NotNull final Subscription subscription) {
checkNotNull(subscription, "subscription == null");
dispatcher.execute(new Runnable() {
@Override
public void run() {
doUnsubscribe(subscription);
}
});
}
内容来源于网络,如有侵权,请联系作者删除!