Tabnine Logo
Record.clone
Code IndexAdd Tabnine to your IDE (free)

How to use
clone
method
in
com.apollographql.apollo.cache.normalized.Record

Best Java code snippets using com.apollographql.apollo.cache.normalized.Record.clone (Showing top 15 results out of 315)

origin: apollographql/apollo-android

RecordJournal(Record mutationRecord) {
 this.snapshot = mutationRecord.clone();
 this.history.add(mutationRecord.clone());
}
origin: apollographql/apollo-android

/**
 * Commits new version of record to the history and invalidate snapshot version.
 */
Set<String> commit(Record record) {
 history.add(history.size(), record.clone());
 return snapshot.mergeWith(record);
}
origin: apollographql/apollo-android

 @NotNull @Override public Record apply(@NotNull Record record) {
  Record result = record.clone();
  result.mergeWith(journal.snapshot);
  return result;
 }
}).or(journal.snapshot.clone());
origin: apollographql/apollo-android

 /**
  * Lookups record by mutation id, if it's found removes it from the history and invalidates snapshot record.
  * Snapshot record is superposition of all record versions in the history.
  */
 Set<String> revert(UUID mutationId) {
  int recordIndex = -1;
  for (int i = 0; i < history.size(); i++) {
   if (mutationId.equals(history.get(i).mutationId())) {
    recordIndex = i;
    break;
   }
  }
  if (recordIndex == -1) {
   return Collections.emptySet();
  }
  Set<String> changedKeys = new HashSet<>();
  changedKeys.add(history.remove(recordIndex).key());
  for (int i = Math.max(0, recordIndex - 1); i < history.size(); i++) {
   Record record = history.get(i);
   if (i == Math.max(0, recordIndex - 1)) {
    snapshot = record.clone();
   } else {
    changedKeys.addAll(snapshot.mergeWith(record));
   }
  }
  return changedKeys;
 }
}
origin: apollographql/apollo-android

@Nullable @Override public Record loadRecord(@NotNull final String key, @NotNull final CacheHeaders cacheHeaders) {
 checkNotNull(key, "key == null");
 checkNotNull(cacheHeaders, "cacheHeaders == null");
 try {
  final Optional<Record> nonOptimisticRecord = nextCache()
    .flatMap(new Function<NormalizedCache, Optional<Record>>() {
     @NotNull @Override public Optional<Record> apply(@NotNull NormalizedCache cache) {
      return Optional.fromNullable(cache.loadRecord(key, cacheHeaders));
     }
    });
  final RecordJournal journal = lruCache.getIfPresent(key);
  if (journal != null) {
   return nonOptimisticRecord.map(new Function<Record, Record>() {
    @NotNull @Override public Record apply(@NotNull Record record) {
     Record result = record.clone();
     result.mergeWith(journal.snapshot);
     return result;
    }
   }).or(journal.snapshot.clone());
  } else {
   return nonOptimisticRecord.orNull();
  }
 } catch (Exception ignore) {
  return null;
 }
}
origin: awslabs/aws-mobile-appsync-sdk-android

RecordJournal(Record mutationRecord) {
 this.snapshot = mutationRecord.clone();
 this.history.add(mutationRecord.clone());
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

RecordJournal(Record mutationRecord) {
 this.snapshot = mutationRecord.clone();
 this.history.add(mutationRecord.clone());
}
origin: awslabs/aws-mobile-appsync-sdk-android

 @Nonnull @Override public Record apply(@Nonnull Record record) {
  Record result = record.clone();
  result.mergeWith(journal.snapshot);
  return result;
 }
}).or(journal.snapshot.clone());
origin: awslabs/aws-mobile-appsync-sdk-android

/**
 * Commits new version of record to the history and invalidate snapshot version.
 */
Set<String> commit(Record record) {
 history.addLast(record.clone());
 return snapshot.mergeWith(record);
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

 @Nonnull @Override public Record apply(@Nonnull Record record) {
  Record result = record.clone();
  result.mergeWith(journal.snapshot);
  return result;
 }
}).or(journal.snapshot.clone());
origin: com.amazonaws/aws-android-sdk-appsync-runtime

/**
 * Commits new version of record to the history and invalidate snapshot version.
 */
Set<String> commit(Record record) {
 history.addLast(record.clone());
 return snapshot.mergeWith(record);
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

 /**
  * Lookups record by mutation id, if it's found removes it from the history and invalidates snapshot record.
  * Snapshot record is superposition of all record versions in the history.
  */
 Set<String> revert(UUID mutationId) {
  int recordIndex = -1;
  for (int i = 0; i < history.size(); i++) {
   if (mutationId.equals(history.get(i).mutationId())) {
    recordIndex = i;
    break;
   }
  }
  if (recordIndex == -1) {
   return Collections.emptySet();
  }
  Set<String> changedKeys = new HashSet<>();
  changedKeys.add(history.remove(recordIndex).key());
  for (int i = Math.max(0, recordIndex - 1); i < history.size(); i++) {
   Record record = history.get(i);
   if (i == Math.max(0, recordIndex - 1)) {
    snapshot = record.clone();
   } else {
    changedKeys.addAll(snapshot.mergeWith(record));
   }
  }
  return changedKeys;
 }
}
origin: awslabs/aws-mobile-appsync-sdk-android

 /**
  * Lookups record by mutation id, if it's found removes it from the history and invalidates snapshot record.
  * Snapshot record is superposition of all record versions in the history.
  */
 Set<String> revert(UUID mutationId) {
  int recordIndex = -1;
  for (int i = 0; i < history.size(); i++) {
   if (mutationId.equals(history.get(i).mutationId())) {
    recordIndex = i;
    break;
   }
  }
  if (recordIndex == -1) {
   return Collections.emptySet();
  }
  Set<String> changedKeys = new HashSet<>();
  changedKeys.add(history.remove(recordIndex).key());
  for (int i = Math.max(0, recordIndex - 1); i < history.size(); i++) {
   Record record = history.get(i);
   if (i == Math.max(0, recordIndex - 1)) {
    snapshot = record.clone();
   } else {
    changedKeys.addAll(snapshot.mergeWith(record));
   }
  }
  return changedKeys;
 }
}
origin: com.amazonaws/aws-android-sdk-appsync-runtime

@Nullable @Override public Record loadRecord(@Nonnull final String key, @Nonnull final CacheHeaders cacheHeaders) {
 checkNotNull(key, "key == null");
 checkNotNull(cacheHeaders, "cacheHeaders == null");
 try {
  final Optional<Record> nonOptimisticRecord = nextCache()
    .flatMap(new Function<NormalizedCache, Optional<Record>>() {
     @Nonnull @Override public Optional<Record> apply(@Nonnull NormalizedCache cache) {
      return Optional.fromNullable(cache.loadRecord(key, cacheHeaders));
     }
    });
  final RecordJournal journal = lruCache.getIfPresent(key);
  if (journal != null) {
   return nonOptimisticRecord.map(new Function<Record, Record>() {
    @Nonnull @Override public Record apply(@Nonnull Record record) {
     Record result = record.clone();
     result.mergeWith(journal.snapshot);
     return result;
    }
   }).or(journal.snapshot.clone());
  } else {
   return nonOptimisticRecord.orNull();
  }
 } catch (Exception ignore) {
  return null;
 }
}
origin: awslabs/aws-mobile-appsync-sdk-android

@Nullable @Override public Record loadRecord(@Nonnull final String key, @Nonnull final CacheHeaders cacheHeaders) {
 checkNotNull(key, "key == null");
 checkNotNull(cacheHeaders, "cacheHeaders == null");
 try {
  final Optional<Record> nonOptimisticRecord = nextCache()
    .flatMap(new Function<NormalizedCache, Optional<Record>>() {
     @Nonnull @Override public Optional<Record> apply(@Nonnull NormalizedCache cache) {
      return Optional.fromNullable(cache.loadRecord(key, cacheHeaders));
     }
    });
  final RecordJournal journal = lruCache.getIfPresent(key);
  if (journal != null) {
   return nonOptimisticRecord.map(new Function<Record, Record>() {
    @Nonnull @Override public Record apply(@Nonnull Record record) {
     Record result = record.clone();
     result.mergeWith(journal.snapshot);
     return result;
    }
   }).or(journal.snapshot.clone());
  } else {
   return nonOptimisticRecord.orNull();
  }
 } catch (Exception ignore) {
  return null;
 }
}
com.apollographql.apollo.cache.normalizedRecordclone

Popular methods of Record

  • builder
  • fields
  • key
  • field
  • mergeWith
  • sizeEstimateBytes
  • <init>
  • adjustSizeEstimate
  • hasField
  • mutationId
  • toBuilder
  • findCacheReferences
  • toBuilder,
  • findCacheReferences,
  • keys,
  • referencedFields

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Github Copilot alternatives
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