Class BasicStoredQuery<E,R>

java.lang.Object
io.micronaut.data.runtime.query.internal.BasicStoredQuery<E,R>
Type Parameters:
E - The entity type
R - The result type
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.naming.Named, StoredDataOperation<R>, StoredQuery<E,R>
Direct Known Subclasses:
QueryResultStoredQuery

@Internal public class BasicStoredQuery<E,R> extends Object implements StoredQuery<E,R>
The basic implementation of StoredQuery.
Since:
3.5.0
Author:
Denis Stepanov
  • Constructor Details

    • BasicStoredQuery

      public BasicStoredQuery(String query, String[] expandableQueryParts, List<QueryParameterBinding> queryParameterBindings, Class<E> rootEntity, Class<R> resultType, StoredQuery.OperationType operationType)
    • BasicStoredQuery

      public BasicStoredQuery(String name, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, String query, String[] expandableQueryParts, List<QueryParameterBinding> queryParameterBindings, Class<E> rootEntity, Class<R> resultType, boolean pageable, boolean isCount, StoredQuery.OperationType operationType)
    • BasicStoredQuery

      public BasicStoredQuery(String name, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, String query, String[] expandableQueryParts, List<QueryParameterBinding> queryParameterBindings, Class<E> rootEntity, Class<R> resultType, boolean pageable, boolean isCount, boolean isDto, StoredQuery.OperationType operationType)
    • BasicStoredQuery

      public BasicStoredQuery(String name, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, String query, String[] expandableQueryParts, List<QueryParameterBinding> queryParameterBindings, Class<E> rootEntity, Class<R> resultType, boolean pageable, boolean isCount, boolean isDto, boolean embeddedProjection, boolean optionalEmbeddedProjection, StoredQuery.OperationType operationType)
      Parameters:
      name - The name
      annotationMetadata - The annotation metadata
      query - The query
      expandableQueryParts - The expandable query parts
      queryParameterBindings - The parameter bindings
      rootEntity - The root entity
      resultType - The result type
      pageable - Whether the query is pageable
      isCount - Whether the query is a count query
      isDto - Whether the query is a DTO projection
      embeddedProjection - Whether the query projects an embedded property
      optionalEmbeddedProjection - Whether the projected embedded property is optional
      operationType - The operation type
      Since:
      5.2.0
  • Method Details

    • isDtoProjection

      public boolean isDtoProjection()
      Description copied from interface: StoredQuery
      Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project. Defaults to false.
      Specified by:
      isDtoProjection in interface StoredQuery<E,R>
      Returns:
      Whether the query is a DTO projection query
    • isOptionalEmbeddedProjection

      public boolean isOptionalEmbeddedProjection()
      Description copied from interface: StoredQuery
      Returns whether the query result is a nullable embedded property of the root entity. Such a result is absent when none of the embedded values is set. Defaults to false.
      Specified by:
      isOptionalEmbeddedProjection in interface StoredQuery<E,R>
      Returns:
      Whether the query result is an optional embedded property
    • getOperationType

      public StoredQuery.OperationType getOperationType()
      Description copied from interface: StoredQuery
      Get the operation type.
      Specified by:
      getOperationType in interface StoredQuery<E,R>
      Returns:
      The operation type.
    • getAnnotationMetadata

      public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Specified by:
      getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
    • getName

      public String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • getRootEntity

      public Class<E> getRootEntity()
      Description copied from interface: StoredQuery
      The root entity type.
      Specified by:
      getRootEntity in interface StoredQuery<E,R>
      Returns:
      The root entity type
    • getResultType

      public Class<R> getResultType()
      Description copied from interface: StoredQuery
      The query result type. This may differ from the root entity type returned by StoredQuery.getRootEntity().
      Specified by:
      getResultType in interface StoredQuery<E,R>
      Returns:
      The query result type
    • getResultArgument

      public io.micronaut.core.type.Argument<R> getResultArgument()
      Description copied from interface: StoredQuery
      The query result type. This may differ from the root entity type returned by StoredQuery.getRootEntity().
      Specified by:
      getResultArgument in interface StoredDataOperation<E>
      Specified by:
      getResultArgument in interface StoredQuery<E,R>
      Returns:
      The query result type
    • getResultDataType

      public DataType getResultDataType()
      Specified by:
      getResultDataType in interface StoredQuery<E,R>
      Returns:
      The result data type.
    • hasPageable

      public boolean hasPageable()
      Description copied from interface: StoredQuery
      Does the query have a pageable.
      Specified by:
      hasPageable in interface StoredQuery<E,R>
      Returns:
      True if it does
    • getQuery

      public String getQuery()
      Description copied from interface: StoredQuery
      The query to execute.
      Specified by:
      getQuery in interface StoredQuery<E,R>
      Returns:
      The query to execute
    • getExpandableQueryParts

      public String[] getExpandableQueryParts()
      Description copied from interface: StoredQuery
      The query to execute.
      Specified by:
      getExpandableQueryParts in interface StoredQuery<E,R>
      Returns:
      The query to execute
    • getQueryBindings

      public List<QueryParameterBinding> getQueryBindings()
      Description copied from interface: StoredQuery
      The list of query bindings.
      Specified by:
      getQueryBindings in interface StoredQuery<E,R>
      Returns:
      the query bindings
    • isCount

      public boolean isCount()
      Specified by:
      isCount in interface StoredQuery<E,R>
      Returns:
      Is this a count query.
    • hasResultConsumer

      public boolean hasResultConsumer()
      Specified by:
      hasResultConsumer in interface StoredQuery<E,R>
      Returns:
      Whether a result consumer is present
    • isRawQuery

      public boolean isRawQuery()
      Description copied from interface: StoredQuery
      Gets an indicator telling whether underlying query is raw query.
      Specified by:
      isRawQuery in interface StoredQuery<E,R>
      Returns:
      true if it is raw query