Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.2k
Remove Datastore's Serializable class and related changes#1240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -22,17 +22,18 @@ | ||
| import com.google.common.base.MoreObjects.ToStringHelper; | ||
| import com.google.common.io.BaseEncoding; | ||
| import com.google.protobuf.ByteString; | ||
| import com.google.protobuf.InvalidProtocolBufferException; | ||
| import java.io.Serializable; | ||
| /** | ||
| * A Google Cloud Datastore cursor. | ||
| * The cursor can be used to as a starting point or an ending point for a {@link Query} | ||
| */ | ||
| public final class Cursor extends Serializable<com.google.datastore.v1.Value> { | ||
| public final class Cursor implements Serializable { | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| private static final long serialVersionUID = -1423744878777486541L; | ||
| private static final long serialVersionUID = 4688656124180503551L; | ||
| private final transient ByteString byteString; | ||
| private final ByteString byteString; | ||
| Cursor(ByteString byteString) { | ||
| this.byteString = byteString; | ||
| @@ -84,17 +85,7 @@ public static Cursor copyFrom(byte[] bytes) { | ||
| return new Cursor(ByteString.copyFrom(checkNotNull(bytes))); | ||
| } | ||
| @Override | ||
| com.google.datastore.v1.Value toPb() { | ||
| return com.google.datastore.v1.Value.newBuilder().setBlobValue(byteString).build(); | ||
| } | ||
| @Override | ||
| Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException { | ||
| return fromPb(com.google.datastore.v1.Value.parseFrom(bytesPb)); | ||
| } | ||
| static Cursor fromPb(com.google.datastore.v1.Value valuePb) { | ||
| return new Cursor(valuePb.getBlobValue()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -18,10 +18,9 @@ | ||
| import static com.google.common.base.Preconditions.checkNotNull; | ||
| import com.google.protobuf.InvalidProtocolBufferException; | ||
| import org.joda.time.format.ISODateTimeFormat; | ||
| import java.io.Serializable; | ||
| import java.util.Calendar; | ||
| import java.util.Date; | ||
| @@ -32,12 +31,11 @@ | ||
| * @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">Google Cloud Datastore | ||
| * Entities, Properties, and Keys</a> | ||
| */ | ||
| public final class DateTime extends Serializable<com.google.protobuf.Timestamp> | ||
| implements Comparable<DateTime> { | ||
| public final class DateTime implements Comparable<DateTime>, Serializable { | ||
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page.
This comment was marked as spam.Sorry, something went wrong. Uh oh!There was an error while loading. Please reload this page. | ||
| private static final long serialVersionUID = 7343324797621228378L; | ||
| private static final long serialVersionUID = 5152143600571559844L; | ||
| private final transient long timestampMicroseconds; | ||
| private final long timestampMicroseconds; | ||
| DateTime(long timestampMicroseconds) { | ||
| this.timestampMicroseconds = timestampMicroseconds; | ||
| @@ -95,17 +93,10 @@ public static DateTime copyFrom(Calendar calendar) { | ||
| return copyFrom(calendar.getTime()); | ||
| } | ||
| @Override | ||
| com.google.protobuf.Timestamp toPb() { | ||
| return microsecondsToTimestampPb(timestampMicroseconds); | ||
| } | ||
| @Override | ||
| Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException { | ||
| return new DateTime(timestampPbToMicroseconds( | ||
| com.google.protobuf.Timestamp.parseFrom(bytesPb))); | ||
| } | ||
| static long timestampPbToMicroseconds(com.google.protobuf.Timestamp timestampPb) { | ||
| return timestampPb.getSeconds() * 1000000 + timestampPb.getNanos() / 1000; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.