Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,16 @@ public static Value.Builder makeValue(Date date) {
return Value.newBuilder().setTimestampValue(toTimestamp(date.getTime() * 1000L));
}

/** Makes a GeoPoint value. */
public static Value.Builder makeValue(LatLng value) {
return Value.newBuilder().setGeoPointValue(value);
}

/** Makes a GeoPoint value. */
public static Value.Builder makeValue(LatLng.Builder value) {
return makeValue(value.build());
}

private static Timestamp.Builder toTimestamp(long microseconds) {
long seconds = microseconds / MICROSECONDS_PER_SECOND;
long microsecondsRemainder = microseconds % MICROSECONDS_PER_SECOND;
Expand All @@ -497,16 +507,6 @@ private static Timestamp.Builder toTimestamp(long microseconds) {
.setNanos((int) microsecondsRemainder * NANOSECONDS_PER_MICROSECOND);
}

/** Makes a GeoPoint value. */
public static Value.Builder makeValue(LatLng value) {
return Value.newBuilder().setGeoPointValue(value);
}

/** Makes a GeoPoint value. */
public static Value.Builder makeValue(LatLng.Builder value) {
return makeValue(value.build());
}

/**
* Make a key from the specified path of kind/id-or-name pairs and/or Keys.
*
Expand Down Expand Up @@ -545,7 +545,8 @@ public static Key.Builder makeKey(Object... elements) {
try {
kind = (String) element;
} catch (ClassCastException e) {
throw new IllegalArgumentException("Expected string or Key, got: " + element.getClass());
throw new IllegalArgumentException(
"Expected string or Key, got: " + element.getClass(), e);
}
pathElement.setKind(kind);
if (pathIndex + 1 < elements.length) {
Expand Down