com.holonplatform.datastore.jdbc.composer.expression

## Interface SQLProjection<R>

- Type Parameters:
    `R` - Projection result type
  All Superinterfaces:
    com.holonplatform.core.Expression, com.holonplatform.core.TypedExpression<R>
  All Known Subinterfaces:
    SQLProjection.MutableSQLProjection<R>

      public interface SQLProjection<R>
      extends com.holonplatform.core.TypedExpression<R>

  `Expression` which represents a SQL query projection, providing the selection labels and an optional `SQLResultConverter`.
  Since:
    5.1.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `SQLProjection.MutableSQLProjection<R>` A mutable `SQLProjection` to configure selection expressions and converter.

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.Expression

      `com.holonplatform.core.Expression.ExpressionResolverFunction<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression>, com.holonplatform.core.Expression.InvalidExpressionException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <R> SQLProjection.MutableSQLProjection<R>` | `create(Class<? extends R> projectionType)` Create a new `SQLProjection`.
    `static <R> SQLProjection.MutableSQLProjection<R>` | `create(Class<? extends R> projectionType, int aliasMainSequence)` Create a new `SQLProjection`.
    `static <R> SQLProjection.MutableSQLProjection<R>` | `create(Class<? extends R> projectionType, SQLCompositionContext context)` Create a new `SQLProjection`.
    `Optional<SQLResultConverter<R>>` | `getConverter()` Get the SQL result converter to be used with this projection, if available.
    `List<String>` | `getSelection()` Get the projection selection names.
    `Optional<String>` | `getSelectionAlias(String selection)` Get the alias for given projection selection name, if defined.

    - ### Methods inherited from interface com.holonplatform.core.TypedExpression

      `getTemporalType, getType, isCollectionExpression, isConverterExpression`

    - ### Methods inherited from interface com.holonplatform.core.Expression

      `validate`

- - ### Method Detail

    - #### getSelection

          List<String> getSelection()

      Get the projection selection names.
      Returns:
        Projection selection names

    - #### getSelectionAlias

          Optional<String> getSelectionAlias(String selection)

      Get the alias for given projection selection name, if defined.
      Parameters:
        `selection` - Selection name
      Returns:
        Selection alias, an empty Optional if not available

    - #### getConverter

          Optional<SQLResultConverter<R>> getConverter()

      Get the SQL result converter to be used with this projection, if available.
      Returns:
        Optional projection `SQLResultConverter`

    - #### create

          static <R> SQLProjection.MutableSQLProjection<R> create(Class<? extends R> projectionType)

      Create a new `SQLProjection`.
      Type Parameters:
        `R` - Projection type
      Parameters:
        `projectionType` - Projection type (not null)
      Returns:
        A new `SQLProjection.MutableSQLProjection` builder to configure selection and converter

    - #### create

          static <R> SQLProjection.MutableSQLProjection<R> create(Class<? extends R> projectionType,
                                                                  int aliasMainSequence)

      Create a new `SQLProjection`.
      Type Parameters:
        `R` - Projection type
      Parameters:
        `projectionType` - Projection type (not null)
        `aliasMainSequence` - Generated alias main sequence, which will be appended to any generated selection alias name
      Returns:
        A new `SQLProjection.MutableSQLProjection` builder to configure selection and converter

    - #### create

          static <R> SQLProjection.MutableSQLProjection<R> create(Class<? extends R> projectionType,
                                                                  SQLCompositionContext context)

      Create a new `SQLProjection`.
      Type Parameters:
        `R` - Projection type
      Parameters:
        `projectionType` - Projection type (not null)
        `context` - SQL context from which to obtain the generated alias main sequence, which will be appended to any generated selection alias name
      Returns:
        A new `SQLProjection.MutableSQLProjection` builder to configure selection and converter

Copyright © 2019 The Holon Platform. All rights reserved.