diff --git a/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java b/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java index 0a8bba8c5..da10978cd 100644 --- a/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java +++ b/datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreHelper.java @@ -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; @@ -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. * @@ -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) {