Class CosmosQuery
- java.lang.Object
-
- com.azure.spring.data.cosmos.core.query.CosmosQuery
-
public class CosmosQuery extends Object
Class for cosmos query
-
-
Constructor Summary
Constructors Constructor Description CosmosQuery(Criteria criteria)Initialization
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CriteriagetCriteria()To get Criteria objectOptional<Criteria>getCriteriaByType(CriteriaType criteriaType)To get criteria by typeintgetLimit()To get limit numberorg.springframework.data.domain.PageablegetPageable()To get Pageable object<T> Optional<Object>getPartitionKeyValue(Class<T> domainType)Returns partition key value based on the criteria.org.springframework.data.domain.SortgetSort()To get Sort objectbooleanhasPartitionKeyCriteria(String partitionKeyFieldName)Returns true if this criteria or sub-criteria has partition key field present as one of the subjects.booleanisCrossPartitionQuery(List<String> partitionKeys)Indicate if DocumentQuery should enable cross partition query.voidsetLimit(int limit)To set limit numberCosmosQuerywith(org.springframework.data.domain.Pageable pageable)With SortCosmosQuerywith(org.springframework.data.domain.Sort sort)With Sort
-
-
-
Constructor Detail
-
CosmosQuery
public CosmosQuery(@NonNull Criteria criteria)Initialization- Parameters:
criteria- object
-
-
Method Detail
-
getCriteria
public Criteria getCriteria()
To get Criteria object- Returns:
- Criteria
-
getSort
public org.springframework.data.domain.Sort getSort()
To get Sort object- Returns:
- Sort
-
getPageable
public org.springframework.data.domain.Pageable getPageable()
To get Pageable object- Returns:
- Pageable
-
getLimit
public int getLimit()
To get limit number- Returns:
- int limit
-
setLimit
public void setLimit(int limit)
To set limit number- Parameters:
limit- int
-
with
public CosmosQuery with(@NonNull org.springframework.data.domain.Sort sort)
With Sort- Parameters:
sort- Sort- Returns:
- DocumentQuery object
-
with
public CosmosQuery with(@NonNull org.springframework.data.domain.Pageable pageable)
With Sort- Parameters:
pageable- Sort- Returns:
- DocumentQuery object
-
isCrossPartitionQuery
public boolean isCrossPartitionQuery(@NonNull List<String> partitionKeys)Indicate if DocumentQuery should enable cross partition query.- Parameters:
partitionKeys- The list of partitionKey names.- Returns:
- If DocumentQuery should enable cross partition query
-
hasPartitionKeyCriteria
public boolean hasPartitionKeyCriteria(@NonNull String partitionKeyFieldName)Returns true if this criteria or sub-criteria has partition key field present as one of the subjects.- Parameters:
partitionKeyFieldName- partition key field name- Returns:
- returns true if this criteria or sub criteria has partition key field present as one of the subjects.
-
getPartitionKeyValue
public <T> Optional<Object> getPartitionKeyValue(@NonNull Class<T> domainType)
Returns partition key value based on the criteria.- Type Parameters:
T- entity class type- Parameters:
domainType- domain type- Returns:
- Optional of partition key value
-
getCriteriaByType
public Optional<Criteria> getCriteriaByType(@NonNull CriteriaType criteriaType)
To get criteria by type- Parameters:
criteriaType- the criteria type- Returns:
- Optional
-
-