diff --git a/api/src/main/java/com/google/appengine/api/datastore/AsyncDatastoreServiceImpl.java b/api/src/main/java/com/google/appengine/api/datastore/AsyncDatastoreServiceImpl.java index 22706635..36a40ef0 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/AsyncDatastoreServiceImpl.java +++ b/api/src/main/java/com/google/appengine/api/datastore/AsyncDatastoreServiceImpl.java @@ -247,7 +247,7 @@ protected TransactionImpl.InternalTransaction doBeginTransaction(TransactionOpti Future future = DatastoreApiHelper.makeAsyncCall( - apiConfig, DatastoreService_3.Method.BeginTransaction, request.build(), remoteTxn.buildPartial()); + apiConfig, DatastoreService_3.Method.BeginTransaction, request.build(), remoteTxn.build()); return new InternalTransactionV3(apiConfig, request.getApp(), future); } @@ -527,7 +527,7 @@ public Future allocateIds(final Key parent, final String kind, long nu req.setModelKey(allocateIdsRef); AllocateIdsResponse.Builder resp = AllocateIdsResponse.newBuilder(); Future future = - makeAsyncCall(apiConfig, DatastoreService_3.Method.AllocateIds, req.buildPartial(), resp.buildPartial()); + makeAsyncCall(apiConfig, DatastoreService_3.Method.AllocateIds, req.build(), resp.build()); return new FutureWrapper(future) { @Override protected KeyRange wrap(AllocateIdsResponse resp) throws Exception { diff --git a/api/src/main/java/com/google/appengine/api/datastore/CompositeIndexManager.java b/api/src/main/java/com/google/appengine/api/datastore/CompositeIndexManager.java index b024b1cf..7fa110a3 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/CompositeIndexManager.java +++ b/api/src/main/java/com/google/appengine/api/datastore/CompositeIndexManager.java @@ -88,7 +88,7 @@ protected String generateXmlForIndex(Index index, IndexSource source) { * @return The index that must be present in order to fulfill the query, or {@code null} if no * index is needed. */ - protected Index.Builder compositeIndexForQuery(final IndexComponentsOnlyQuery indexOnlyQuery) { + protected Index.Builder compositeIndexForQuery(final IndexComponentsOnlyQuery indexOnlyQuery) { DatastoreV3Pb.Query.Builder query = indexOnlyQuery.getQuery().toBuilder(); boolean hasKind = query.hasKind(); diff --git a/api/src/main/java/com/google/appengine/api/datastore/DataTypeTranslator.java b/api/src/main/java/com/google/appengine/api/datastore/DataTypeTranslator.java index 778acd81..60c65bdd 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/DataTypeTranslator.java +++ b/api/src/main/java/com/google/appengine/api/datastore/DataTypeTranslator.java @@ -260,9 +260,9 @@ private static void addListPropertyToPb( } property.getValue(); // Indicate to the proto that we have set this field if (indexed) { - proto.addProperty(property.buildPartial()); + proto.addProperty(property.build()); } else { - proto.addRawProperty(property.buildPartial()); + proto.addRawProperty(property.build()); } } else { // Write every element to the PB @@ -395,7 +395,7 @@ private static Property buildImplicitKeyProperty(EntityProto proto) { PropertyValue.Builder propVal = PropertyValue.newBuilder(); propVal.setReferenceValue(KeyType.toReferenceValue(proto.getKey())); keyProp.setValue(propVal.build()); - return keyProp.buildPartial(); + return keyProp.build(); } /** @@ -1663,7 +1663,7 @@ public EmbeddedEntity getValue(PropertyValue propertyValue) { if (proto.hasKey() && !proto.getKey().getApp().isEmpty()) { result.setKey(KeyTranslator.createFromPb(proto.getKey())); } - extractPropertiesFromPb(proto.buildPartial(), result.getPropertyMap()); + extractPropertiesFromPb(proto.build(), result.getPropertyMap()); return result; } @@ -1687,7 +1687,7 @@ public void toV3Value(Object value, PropertyValue.Builder propertyValue) { } addPropertiesToPb(structProp.getPropertyMap(), proto); // TODO: Figure out how to do partial serialization. - propertyValue.setStringValueBytes(proto.buildPartial().toByteString()).buildPartial(); + propertyValue.setStringValueBytes(proto.build().toByteString()).build(); } @Override diff --git a/api/src/main/java/com/google/appengine/api/datastore/EntityTranslator.java b/api/src/main/java/com/google/appengine/api/datastore/EntityTranslator.java index 7e2cfd60..b90fed89 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/EntityTranslator.java +++ b/api/src/main/java/com/google/appengine/api/datastore/EntityTranslator.java @@ -87,7 +87,7 @@ public static EntityProto convertToPb(Entity entity) { } DataTypeTranslator.addPropertiesToPb(entity.getPropertyMap(), proto); - return proto.buildPartial(); + return proto.build(); } // All methods are static. Do not instantiate. diff --git a/api/src/main/java/com/google/appengine/api/datastore/IndexTranslator.java b/api/src/main/java/com/google/appengine/api/datastore/IndexTranslator.java index 9ff1f653..a9cb79b1 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/IndexTranslator.java +++ b/api/src/main/java/com/google/appengine/api/datastore/IndexTranslator.java @@ -73,6 +73,6 @@ public static Index.Property convertFromPb(OnestoreEntity.Index.Property propert } public static Index convertFromPb(OnestoreEntity.Index index) { - return convertFromPb(OnestoreEntity.CompositeIndex.newBuilder().setId(0).setDefinition(index).buildPartial()); + return convertFromPb(OnestoreEntity.CompositeIndex.newBuilder().setId(0).setDefinition(index).build()); } } diff --git a/api/src/main/java/com/google/appengine/api/datastore/KeyTranslator.java b/api/src/main/java/com/google/appengine/api/datastore/KeyTranslator.java index 9dc54e7b..63588050 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/KeyTranslator.java +++ b/api/src/main/java/com/google/appengine/api/datastore/KeyTranslator.java @@ -72,7 +72,7 @@ public static Reference convertToPb(Key key) { reference.setNameSpace(nameSpace); } - Path.Builder path = reference.buildPartial().getPath().toBuilder(); + Path.Builder path = reference.getPathBuilder(); while (key != null) { Element.Builder pathElement = Element.newBuilder(); pathElement.setType(key.getKind()); @@ -91,7 +91,7 @@ public static Reference convertToPb(Key key) { reversedPath.addElement(element); } reference.setPath(reversedPath.build()); - return reference.buildPartial(); + return reference.build(); } public static void updateKey(Reference reference, Key key) { diff --git a/api/src/main/java/com/google/appengine/api/datastore/QueryResultsSourceV3.java b/api/src/main/java/com/google/appengine/api/datastore/QueryResultsSourceV3.java index f70af19c..1eb67a84 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/QueryResultsSourceV3.java +++ b/api/src/main/java/com/google/appengine/api/datastore/QueryResultsSourceV3.java @@ -61,7 +61,7 @@ public NextRequest buildNextCallPrototype(QueryResult initialResult) { req.setCompile(true); } // This used to call .freeze() but that method has been deleted, see go/javaproto1freezeremoval - return req.buildPartial(); + return req.build(); } @Override diff --git a/api/src/main/java/com/google/appengine/api/datastore/QueryRunnerV3.java b/api/src/main/java/com/google/appengine/api/datastore/QueryRunnerV3.java index 4fedf3f3..388627c5 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/QueryRunnerV3.java +++ b/api/src/main/java/com/google/appengine/api/datastore/QueryRunnerV3.java @@ -50,7 +50,7 @@ public QueryResultsSource runQuery(FetchOptions fetchOptions, Query query, Trans Future result = DatastoreApiHelper.makeAsyncCall( - apiConfig, Method.RunQuery, queryProto.buildPartial(), DatastoreV3Pb.QueryResult.newBuilder().buildPartial()); + apiConfig, Method.RunQuery, queryProto.build(), DatastoreV3Pb.QueryResult.getDefaultInstance()); // Adding more info to DatastoreNeedIndexException if thrown result = @@ -58,7 +58,7 @@ public QueryResultsSource runQuery(FetchOptions fetchOptions, Query query, Trans @Override protected Throwable convertException(Throwable cause) { if (cause instanceof DatastoreNeedIndexException) { - addMissingIndexData(queryProto.buildPartial(), (DatastoreNeedIndexException) cause); + addMissingIndexData(queryProto.build(), (DatastoreNeedIndexException) cause); } return cause; } diff --git a/api/src/main/java/com/google/appengine/api/datastore/QueryTranslator.java b/api/src/main/java/com/google/appengine/api/datastore/QueryTranslator.java index 37cc70b1..383f045d 100644 --- a/api/src/main/java/com/google/appengine/api/datastore/QueryTranslator.java +++ b/api/src/main/java/com/google/appengine/api/datastore/QueryTranslator.java @@ -133,7 +133,7 @@ public static DatastoreV3Pb.Query convertToPb(Query query, FetchOptions fetchOpt proto.addPropertyName(projection.getPropertyName()); } - return proto.buildPartial(); + return proto.build(); } static Order convertSortPredicateToPb(Query.SortPredicate predicate) { @@ -213,7 +213,7 @@ private static Filter convertFilterPredicateToPb(Query.FilterPredicate predicate .setValue(DataTypeTranslator.toV3Value(predicate.getValue())); } - return filterPb.buildPartial(); + return filterPb.build(); } private static DatastoreV3Pb.GeoRegion convertGeoRegionToPb(Query.GeoRegion region) { diff --git a/api_dev/src/main/java/com/google/appengine/tools/development/ApiUtils.java b/api_dev/src/main/java/com/google/appengine/tools/development/ApiUtils.java index 533e648f..9c2902bd 100644 --- a/api_dev/src/main/java/com/google/appengine/tools/development/ApiUtils.java +++ b/api_dev/src/main/java/com/google/appengine/tools/development/ApiUtils.java @@ -19,7 +19,6 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import com.google.protobuf.MessageLite; -import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -50,7 +49,7 @@ public static T convertBytesToPb(byte[] bytes, Class messageClass) throw new RuntimeException( "Could not parse request bytes into " + classDescription(messageClass)); } - return messageClass.cast(proto.buildPartial()); + return messageClass.cast(proto.build()); } if (Message.class.isAssignableFrom(messageClass)) { Method method = messageClass.getMethod("parseFrom", byte[].class);