com.holonplatform.datastore.jdbc.composer.internal

## Class DefaultSQLStatementCompositionContext

- java.lang.Object
- - com.holonplatform.datastore.jdbc.composer.internal.DefaultSQLCompositionContext
  - - com.holonplatform.datastore.jdbc.composer.internal.DefaultSQLStatementCompositionContext

- All Implemented Interfaces:
    com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler, com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider, com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport, com.holonplatform.core.ExpressionResolver.ResolutionContext, SQLCompositionContext, SQLContext, SQLStatementCompositionContext

      public class DefaultSQLStatementCompositionContext
      extends DefaultSQLCompositionContext
      implements SQLStatementCompositionContext

  Default `SQLStatementCompositionContext` implementation.
  Since:
    5.1.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.datastore.jdbc.composer.SQLStatementCompositionContext

      `SQLStatementCompositionContext.AliasMode`

    - ### Nested classes/interfaces inherited from interface com.holonplatform.datastore.jdbc.composer.SQLCompositionContext

      `SQLCompositionContext.SQLStatementPreparationException`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultSQLStatementCompositionContext(SQLCompositionContext parent, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, SQLStatementCompositionContext.AliasMode aliasMode)` Constructor with parent composition context.
    `DefaultSQLStatementCompositionContext(SQLContext context, com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget, SQLStatementCompositionContext.AliasMode aliasMode)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Optional<String>` | `getAlias(com.holonplatform.core.Path<?> path, boolean useParentContext)` Get the given `path` alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.
    `Optional<String>` | `getRootAlias()` Get the query root path (target) alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

    - ### Methods inherited from class com.holonplatform.datastore.jdbc.composer.internal.DefaultSQLCompositionContext

      `addExpressionResolver, childContext, getDialect, getExpressionResolvers, getNamedParametersHandler, getParent, getValueDeserializer, getValueSerializer, prepareStatement, removeExpressionResolver, resolve, trace`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLStatementCompositionContext

      `asChild, create, getAliasOrRoot`

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLCompositionContext

      `addNamedParameter, childContext, create, getContextSequence, getNamedParametersHandler, getParent, isSQLCompositionContext, isStatementCompositionContext, prepareStatement, resolve, resolveOrFail`

    - ### Methods inherited from interface com.holonplatform.datastore.jdbc.composer.SQLContext

      `getDialect, getTypeConverter, getValueDeserializer, getValueSerializer, trace`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler

      `resolve`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider

      `getExpressionResolvers`

    - ### Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport

      `addExpressionResolver, addExpressionResolvers, removeExpressionResolver`

- - ### Constructor Detail

    - #### DefaultSQLStatementCompositionContext

          public DefaultSQLStatementCompositionContext(SQLContext context,
                                                       com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                       SQLStatementCompositionContext.AliasMode aliasMode)

      Constructor.
      Parameters:
        `context` - SQL context (not null)
        `rootTarget` - Root query target (not null)
        `aliasMode` - Alias handling mode (not null)

    - #### DefaultSQLStatementCompositionContext

          public DefaultSQLStatementCompositionContext(SQLCompositionContext parent,
                                                       com.holonplatform.core.datastore.relational.RelationalTarget<?> rootTarget,
                                                       SQLStatementCompositionContext.AliasMode aliasMode)

      Constructor with parent composition context.
      Parameters:
        `parent` - Parent composition context (not null)
        `rootTarget` - Root query target (not null)
        `aliasMode` - Alias handling mode (not null)

  - ### Method Detail

    - #### getRootAlias

          public Optional<String> getRootAlias()

      Description copied from interface: `SQLStatementCompositionContext`
      Get the query root path (target) alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the root path is `Aliasable`, or an auto generated name if alias mode is `SQLStatementCompositionContext.AliasMode.AUTO`.

      Specified by:
        `getRootAlias` in interface `SQLStatementCompositionContext`
      Returns:
        the query root path alias, empty if not available

    - #### getAlias

          public Optional<String> getAlias(com.holonplatform.core.Path<?> path,
                                           boolean useParentContext)

      Description copied from interface: `SQLStatementCompositionContext`
      Get the given `path` alias, if available and alias mode is not `SQLStatementCompositionContext.AliasMode.UNSUPPORTED`.

      The alias will be the explicit alias name if the path is `Aliasable`, or an auto generated name if alias mode is `SQLStatementCompositionContext.AliasMode.AUTO`.

      Specified by:
        `getAlias` in interface `SQLStatementCompositionContext`
      Parameters:
        `path` - Path for which to get the alias (not null)
        `useParentContext` - Whether to check in parent contexts if an alias is available when not available is current context
      Returns:
        the path alias, empty if not available

Copyright © 2019 The Holon Platform. All rights reserved.