congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Response$Builder.fromCache
Code IndexAdd Tabnine to your IDE (free)

How to use
fromCache
method
in
com.apollographql.apollo.api.Response$Builder

Best Java code snippets using com.apollographql.apollo.api.Response$Builder.fromCache (Showing top 12 results out of 315)

origin: apollographql/apollo-android

@SuppressWarnings("unchecked") InterceptorResponse parse(Operation operation, okhttp3.Response httpResponse)
  throws ApolloHttpException, ApolloParseException {
 String cacheKey = httpResponse.request().header(HttpCache.CACHE_KEY_HEADER);
 if (httpResponse.isSuccessful()) {
  try {
   OperationResponseParser parser = new OperationResponseParser(operation, responseFieldMapper, scalarTypeAdapters,
     normalizer);
   Response parsedResponse = parser.parse(httpResponse.body().source())
     .toBuilder()
     .fromCache(httpResponse.cacheResponse() != null)
     .build();
   if (parsedResponse.hasErrors() && httpCache != null) {
    httpCache.removeQuietly(cacheKey);
   }
   return new InterceptorResponse(httpResponse, parsedResponse, normalizer.records());
  } catch (Exception rethrown) {
   logger.e(rethrown, "Failed to parse network response for operation: %s", operation);
   closeQuietly(httpResponse);
   if (httpCache != null) {
    httpCache.removeQuietly(cacheKey);
   }
   throw new ApolloParseException("Failed to parse http response", rethrown);
  }
 } else {
  logger.e("Failed to parse network response: %s", httpResponse);
  throw new ApolloHttpException(httpResponse);
 }
}
origin: apollographql/apollo-android

 @NotNull @Override public Response<T> execute(ReadableStore cache) {
  Record rootRecord = cache.read(CacheKeyResolver.rootKeyForOperation(operation).key(), cacheHeaders);
  if (rootRecord == null) {
   return Response.<T>builder(operation).fromCache(true).build();
  }
  CacheFieldValueResolver fieldValueResolver = new CacheFieldValueResolver(cache, operation.variables(),
    cacheKeyResolver(), cacheHeaders, cacheKeyBuilder);
  RealResponseReader<Record> responseReader = new RealResponseReader<>(operation.variables(), rootRecord,
    fieldValueResolver, scalarTypeAdapters, responseNormalizer);
  try {
   responseNormalizer.willResolveRootQuery(operation);
   T data = operation.wrapData(responseFieldMapper.map(responseReader));
   return Response.<T>builder(operation)
     .data(data)
     .fromCache(true)
     .dependentKeys(responseNormalizer.dependentKeys())
     .build();
  } catch (Exception e) {
   logger.e(e, "Failed to read cache response");
   return Response.<T>builder(operation).fromCache(true).build();
  }
 }
});
origin: com.amazonaws/aws-android-sdk-appsync-runtime

Response parsedResponse = parser.parse(httpResponse.body().source())
  .toBuilder()
  .fromCache(httpResponse.cacheResponse() != null)
  .build();
if (parsedResponse.hasErrors() && httpCache != null) {
origin: awslabs/aws-mobile-appsync-sdk-android

Response parsedResponse = parser.parse(httpResponse.body().source())
  .toBuilder()
  .fromCache(httpResponse.cacheResponse() != null)
  .build();
if (parsedResponse.hasErrors() && httpCache != null) {
origin: awslabs/aws-mobile-appsync-sdk-android

 @Nonnull @Override public Response<T> execute(ReadableStore cache) {
  Record rootRecord = cache.read(CacheKeyResolver.rootKeyForOperation(operation).key(), cacheHeaders);
  if (rootRecord == null) {
   return Response.<T>builder(operation).fromCache(true).build();
  }
  CacheFieldValueResolver fieldValueResolver = new CacheFieldValueResolver(cache, operation.variables(),
    cacheKeyResolver(), cacheHeaders);
  RealResponseReader<Record> responseReader = new RealResponseReader<>(operation.variables(), rootRecord,
    fieldValueResolver, scalarTypeAdapters, responseNormalizer);
  try {
   responseNormalizer.willResolveRootQuery(operation);
   T data = operation.wrapData(responseFieldMapper.map(responseReader));
   return Response.<T>builder(operation)
     .data(data)
     .fromCache(true)
     .dependentKeys(responseNormalizer.dependentKeys())
     .build();
  } catch (Exception e) {
   logger.e(e, "Failed to read cache response");
   return Response.<T>builder(operation).fromCache(true).build();
  }
 }
});
origin: com.amazonaws/aws-android-sdk-appsync-runtime

 @Nonnull @Override public Response<T> execute(ReadableStore cache) {
  Record rootRecord = cache.read(CacheKeyResolver.rootKeyForOperation(operation).key(), cacheHeaders);
  if (rootRecord == null) {
   return Response.<T>builder(operation).fromCache(true).build();
  }
  CacheFieldValueResolver fieldValueResolver = new CacheFieldValueResolver(cache, operation.variables(),
    cacheKeyResolver(), cacheHeaders);
  RealResponseReader<Record> responseReader = new RealResponseReader<>(operation.variables(), rootRecord,
    fieldValueResolver, scalarTypeAdapters, responseNormalizer);
  try {
   responseNormalizer.willResolveRootQuery(operation);
   T data = operation.wrapData(responseFieldMapper.map(responseReader));
   return Response.<T>builder(operation)
     .data(data)
     .fromCache(true)
     .dependentKeys(responseNormalizer.dependentKeys())
     .build();
  } catch (Exception e) {
   logger.e(e, "Failed to read cache response");
   return Response.<T>builder(operation).fromCache(true).build();
  }
 }
});
origin: awslabs/aws-mobile-appsync-sdk-android

 private InterceptorResponse cacheMissResponse(Operation operation) {
  return new InterceptorResponse(null, Response.builder(operation).fromCache(true).build(), null);
 }
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

 private InterceptorResponse cacheMissResponse(Operation operation) {
  return new InterceptorResponse(null, Response.builder(operation).fromCache(true).build(), null);
 }
}
origin: awslabs/aws-mobile-appsync-sdk-android

public Builder<T> toBuilder() {
 return new Builder<T>(operation)
   .data(data)
   .errors(errors)
   .dependentKeys(dependentKeys)
   .fromCache(fromCache);
}
origin: com.amazonaws/aws-android-sdk-appsync-api

public Builder<T> toBuilder() {
 return new Builder<T>(operation)
   .data(data)
   .errors(errors)
   .dependentKeys(dependentKeys)
   .fromCache(fromCache);
}
origin: apollographql/apollo-android

 InterceptorResponse cacheMissResponse(Operation operation) {
  return new InterceptorResponse(null, Response.builder(operation).fromCache(true).build(), null);
 }
}
origin: apollographql/apollo-android

public Builder<T> toBuilder() {
 return new Builder<T>(operation)
   .data(data)
   .errors(errors)
   .dependentKeys(dependentKeys)
   .fromCache(fromCache);
}
com.apollographql.apollo.apiResponse$BuilderfromCache

Popular methods of Response$Builder

  • data
  • errors
  • dependentKeys
  • build
  • <init>

Popular in Java

  • Finding current android device location
  • setContentView (Activity)
  • putExtra (Intent)
  • runOnUiThread (Activity)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now