com.microsoft.azure.documentdb.internal.query.PartitionedQueryExecutionInfo Maven / Gradle / Ivy
package com.microsoft.azure.documentdb.internal.query;
import java.util.List;
import org.json.JSONObject;
import com.microsoft.azure.documentdb.JsonSerializable;
import com.microsoft.azure.documentdb.internal.Constants;
import com.microsoft.azure.documentdb.internal.routing.Range;
/**
* Used internally to encapsulates execution information for a query in the Azure Cosmos DB database service.
*/
public final class PartitionedQueryExecutionInfo extends JsonSerializable {
@SuppressWarnings("unchecked")
private static final Class> QUERY_RANGES_CLASS = (Class>) Range
.getEmptyRange((String) null).getClass();
private QueryInfo queryInfo;
private List> queryRanges;
PartitionedQueryExecutionInfo(QueryInfo queryInfo, List> queryRanges) {
this.queryInfo = queryInfo;
this.queryRanges = queryRanges;
super.set(
PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY,
Constants.PartitionedQueryExecutionInfo.VERSION_1);
}
public PartitionedQueryExecutionInfo(String jsonString) {
super(jsonString);
}
public PartitionedQueryExecutionInfo(JSONObject jsonObject) {
super(jsonObject);
}
public int getVersion() {
return super.getInt(PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY);
}
public QueryInfo getQueryInfo() {
return this.queryInfo != null ? this.queryInfo
: (this.queryInfo = super.getObject(
PartitionedQueryExecutionInfoInternal.QUERY_INFO_PROPERTY, QueryInfo.class));
}
public List> getQueryRanges() {
return this.queryRanges != null ? this.queryRanges
: (this.queryRanges = (List>) super.getCollection(
PartitionedQueryExecutionInfoInternal.QUERY_RANGES_PROPERTY, QUERY_RANGES_CLASS));
}
}