com.google.cloud.datastore.Query Maven / Gradle / Ivy
Show all versions of google-cloud-datastore Show documentation
/*
* Copyright 2015 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.datastore;
import com.google.api.core.InternalApi;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.collect.Maps;
import java.io.Serializable;
import java.util.Map;
/**
* A Google Cloud Datastore query. For usage examples see {@link GqlQuery}, {@link StructuredQuery}
* and {@link AggregationQuery}.
*
* Note that queries require proper indexing. See Cloud Datastore Index
* Configuration for help configuring indexes.
*
* @param the type of the values returned by this query.
* @see Datastore Queries
*/
public abstract class Query implements Serializable {
private static final long serialVersionUID = 7967659059395653941L;
private final String namespace;
/**
* This class represents the expected type of the result. ENTITY: A full entity represented by
* {@link Entity}. PROJECTION_ENTITY: A projection entity, represented by {@link
* ProjectionEntity}. KEY: An entity's {@link Key}.
*/
public abstract static class ResultType implements Serializable {
private static final long serialVersionUID = 2104157695425806623L;
private static final Map>
PB_TO_INSTANCE = Maps.newEnumMap(com.google.datastore.v1.EntityResult.ResultType.class);
static final ResultType> UNKNOWN =
new ResultType