Class CosmosQuery

java.lang.Object
com.azure.spring.data.cosmos.core.query.CosmosQuery

public class CosmosQuery extends Object
Class for cosmos query
  • Constructor Details

    • CosmosQuery

      public CosmosQuery(@NonNull Criteria criteria)
      Initialization
      Parameters:
      criteria - object
  • Method Details

    • 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
    • getOffset

      public long getOffset()
      To get offset number
      Returns:
      long offset
    • setLimit

      @Deprecated public void setLimit(int limit)
      Deprecated.
      use withLimit instead
      To set limit number
      Parameters:
      limit - int
    • withLimit

      public CosmosQuery withLimit(int limit)
      To set limit number
      Parameters:
      limit - int
      Returns:
      CosmosQuery object
    • withOffsetAndLimit

      public CosmosQuery withOffsetAndLimit(long offset, int limit)
      To set limit number and offset number
      Parameters:
      offset - long
      limit - int
      Returns:
      CosmosQuery object
    • with

      public CosmosQuery with(@NonNull org.springframework.data.domain.Sort sort)
      With Sort
      Parameters:
      sort - Sort
      Returns:
      CosmosQuery object
    • with

      public CosmosQuery with(@NonNull org.springframework.data.domain.Pageable pageable)
      With Sort
      Parameters:
      pageable - Sort
      Returns:
      CosmosQuery 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