@@ -0,0 +1,1702 @@
+package com.google.gcloud.datastore;%0A%0Aimport com.google.api.services.datastore.DatastoreV1;%0Aimport com.google.gcloud.datastore.DatastoreServiceException.Code;%0Aimport com.google.protobuf.ByteString;%0Aimport com.google.protobuf.InvalidProtocolBufferException;%0A%0Apublic final class StructuredQuery%3CT%3E extends Query%3CT%3E %7B%0A%0A  private static final long serialVersionUID = 546838955624019594L;%0A%0A%0A  static class BaseBuilder%3CT%3E %7B%0A    // TODO: impelement and have sub-classes for keys-only, entity and projection%0A  %7D%0A%0A  private StructuredQuery(String namespace) %7B%0A    super(namespace);%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    // implement%0A    return 0;%0A  %7D%0A%0A  @Override%0A  public boolean equals(Object obj) %7B%0A    if (obj == this) %7B%0A      return true;%0A    %7D%0A    // implement%0A    return false;%0A  %7D%0A%0A  @Override%0A  protected void populatePb(DatastoreV1.RunQueryRequest.Builder requestPb, int totalRead,%0A      ByteString batchCursor) %7B%0A    if (batchCursor == null) %7B%0A      requestPb.setQuery(toPb());%0A      return;%0A    %7D%0A    throw new UnsupportedOperationException(%22paging not implemented yet%22);%0A  %7D%0A%0A  @Override%0A  protected Object fromPb(String namespace, byte%5B%5D bytesPb) throws InvalidProtocolBufferException %7B%0A    return fromPb(namespace, DatastoreV1.Query.parseFrom(bytesPb));%0A  %7D%0A%0A  @Override%0A  protected DatastoreV1.Query toPb() %7B%0A    // TODO Auto-generated method stub%0A    return null;%0A  %7D%0A%0A  static StructuredQuery%3C?%3E fromPb(String namespace, DatastoreV1.Query queryPb) %7B%0A    return null;%0A  %7D%0A%0A  static DatastoreV1.Query nextQuery(DatastoreV1.Query query, ByteString cursor) %7B%0A    // see b/18705483%0A    throw new DatastoreServiceException(Code.INTERNAL, %22paging for gql results is not implemented%22);%0A  %7D%0A%7D%0A

work in progress for structured query