Java Code Examples for com.google.ipc.invalidation.external.client.types.Invalidation#newInstance()
The following examples show how to use
com.google.ipc.invalidation.external.client.types.Invalidation#newInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtoWrapperConverter.java From 365browser with Apache License 2.0 | 5 votes |
/** * Converts an invalidation protocol buffer {@code invalidation} to the * corresponding external object and returns it */ public static Invalidation convertFromInvalidationProto(InvalidationP invalidation) { Preconditions.checkNotNull(invalidation); ObjectId objectId = convertFromObjectIdProto(invalidation.getObjectId()); // No bridge arrival time in invalidation. return Invalidation.newInstance(objectId, invalidation.getVersion(), invalidation.hasPayload() ? invalidation.getPayload().getByteArray() : null, invalidation.getIsTrickleRestart()); }
Example 2
Source File: ProtoConverter.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Converts an invalidation protocol buffer {@code invalidation} to the * corresponding external object and returns it */ public static Invalidation convertFromInvalidationProto(InvalidationP invalidation) { Preconditions.checkNotNull(invalidation); ObjectId objectId = convertFromObjectIdProto(invalidation.getObjectId()); // No bridge arrival time in invalidation. return Invalidation.newInstance(objectId, invalidation.getVersion(), invalidation.hasPayload() ? invalidation.getPayload().toByteArray() : null, invalidation.getIsTrickleRestart()); }
Example 3
Source File: ParcelableInvalidation.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Creates a new invalidation wrapper by reading data from a parcel. */ public ParcelableInvalidation(Parcel in) { // Read parcelable object id from parcel using the application class loader ParcelableObjectId objectId = in.readParcelable(getClass().getClassLoader()); long version = in.readLong(); boolean isTrickleRestart = in.createBooleanArray()[0]; boolean[] values = in.createBooleanArray(); byte[] payload = null; if (values[0]) { // hasPayload payload = in.createByteArray(); } this.invalidation = Invalidation.newInstance(objectId.objectId, version, payload, isTrickleRestart); this.includePayload = payload != null; }
Example 4
Source File: ProtoConverter.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Converts an invalidation protocol buffer {@code invalidation} to the * corresponding external object and returns it */ public static Invalidation convertFromInvalidationProto(InvalidationP invalidation) { Preconditions.checkNotNull(invalidation); ObjectId objectId = convertFromObjectIdProto(invalidation.getObjectId()); // No bridge arrival time in invalidation. return Invalidation.newInstance(objectId, invalidation.getVersion(), invalidation.hasPayload() ? invalidation.getPayload().toByteArray() : null, invalidation.getIsTrickleRestart()); }
Example 5
Source File: ParcelableInvalidation.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Creates a new invalidation wrapper by reading data from a parcel. */ public ParcelableInvalidation(Parcel in) { // Read parcelable object id from parcel using the application class loader ParcelableObjectId objectId = in.readParcelable(getClass().getClassLoader()); long version = in.readLong(); boolean isTrickleRestart = in.createBooleanArray()[0]; boolean[] values = in.createBooleanArray(); byte[] payload = null; if (values[0]) { // hasPayload payload = in.createByteArray(); } this.invalidation = Invalidation.newInstance(objectId.objectId, version, payload, isTrickleRestart); this.includePayload = payload != null; }