com.holonplatform.datastore.jdbc.composer.internal

## Class DefaultSQLCompositionContext

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

- 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
  Direct Known Subclasses:
    DefaultSQLStatementCompositionContext

      public class DefaultSQLCompositionContext
      extends Object
      implements SQLCompositionContext

  Default `SQLCompositionContext` implementation.
  Since:
    5.1.0

- - ### Nested Class Summary

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

      `SQLCompositionContext.SQLStatementPreparationException`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultSQLCompositionContext(SQLCompositionContext parent)` Constructor with parent composition context.
    `DefaultSQLCompositionContext(SQLContext context)` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void` | `addExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)`
    `SQLCompositionContext` | `childContext()` Create a new `SQLCompositionContext` as child of this context.
    `SQLDialect` | `getDialect()` Get the `SQLDialect` to use.
    `Iterable<com.holonplatform.core.ExpressionResolver>` | `getExpressionResolvers()`
    `SQLContextParametersHandler` | `getNamedParametersHandler()` Get the SQL named parameters handler.
    `Optional<SQLCompositionContext>` | `getParent()` Get the parent context, if available.
    `SQLValueDeserializer` | `getValueDeserializer()` Get the `SQLValueDeserializer` of this context.
    `SQLValueSerializer` | `getValueSerializer()` Get the `SQLValueSerializer` of this context.
    `SQLStatement` | `prepareStatement(String sql)` Prepare given SQL statement, replacing named parameters with the default `?`
    `<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void` | `removeExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)`
    `<E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> Optional<R>` | `resolve(E expression, Class<R> resolutionType, com.holonplatform.core.ExpressionResolver.ResolutionContext context)`
    `void` | `trace(String sql)` Trace given SQL statement.

    - ### 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.SQLCompositionContext

      `addNamedParameter, create, getContextSequence, isSQLCompositionContext, isStatementCompositionContext, resolve, resolveOrFail`

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

      `getTypeConverter`

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

      `addExpressionResolvers`

- - ### Constructor Detail

    - #### DefaultSQLCompositionContext

          public DefaultSQLCompositionContext(SQLContext context)

      Default constructor.
      Parameters:
        `context` - SQL context (not null)

    - #### DefaultSQLCompositionContext

          public DefaultSQLCompositionContext(SQLCompositionContext parent)

      Constructor with parent composition context.
      Parameters:
        `parent` - Parent context (not null)

  - ### Method Detail

    - #### getParent

          public Optional<SQLCompositionContext> getParent()

      Description copied from interface: `SQLCompositionContext`
      Get the parent context, if available.
      Specified by:
        `getParent` in interface `SQLCompositionContext`
      Returns:
        Optional parent context

    - #### getDialect

          public SQLDialect getDialect()

      Description copied from interface: `SQLContext`
      Get the `SQLDialect` to use.
      Specified by:
        `getDialect` in interface `SQLContext`
      Returns:
        The SQL dialect

    - #### getValueSerializer

          public SQLValueSerializer getValueSerializer()

      Description copied from interface: `SQLContext`
      Get the `SQLValueSerializer` of this context.
      Specified by:
        `getValueSerializer` in interface `SQLContext`
      Returns:
        The `SQLValueSerializer`

    - #### getValueDeserializer

          public SQLValueDeserializer getValueDeserializer()

      Description copied from interface: `SQLContext`
      Get the `SQLValueDeserializer` of this context.
      Specified by:
        `getValueDeserializer` in interface `SQLContext`
      Returns:
        the `SQLValueDeserializer`

    - #### trace

          public void trace(String sql)

      Description copied from interface: `SQLContext`
      Trace given SQL statement.

      If tracing is enabled, the SQL statement is logged using the `INFO` level, otherwise it is logged using the `DEBUG` level.

      Specified by:
        `trace` in interface `SQLContext`
      Parameters:
        `sql` - SQL to trace

    - #### getNamedParametersHandler

          public SQLContextParametersHandler getNamedParametersHandler()

      Description copied from interface: `SQLCompositionContext`
      Get the SQL named parameters handler.
      Specified by:
        `getNamedParametersHandler` in interface `SQLCompositionContext`
      Returns:
        the SQL named parameters handler

    - #### prepareStatement

          public SQLStatement prepareStatement(String sql)

      Description copied from interface: `SQLCompositionContext`
      Prepare given SQL statement, replacing named parameters with the default `?` parameter placeholder.
      Specified by:
        `prepareStatement` in interface `SQLCompositionContext`
      Parameters:
        `sql` - The SQL statement to prepare (not null)
      Returns:
        An `SQLStatement` which provides the prepared SQL and the statement parameter definition in the right order according to the parameters placeholder index

    - #### childContext

          public SQLCompositionContext childContext()

      Description copied from interface: `SQLCompositionContext`
      Create a new `SQLCompositionContext` as child of this context. This context will be setted as parent of the new context.
      Specified by:
        `childContext` in interface `SQLCompositionContext`
      Returns:
        A new `SQLCompositionContext` with this context as parent

    - #### getExpressionResolvers

          public Iterable<com.holonplatform.core.ExpressionResolver> getExpressionResolvers()

      Specified by:
        `getExpressionResolvers` in interface `com.holonplatform.core.ExpressionResolver.ExpressionResolverProvider`

    - #### resolve

          public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> Optional<R> resolve(E expression,
                                                                                                                               Class<R> resolutionType,
                                                                                                                               com.holonplatform.core.ExpressionResolver.ResolutionContext context)
                                                                                                                        throws com.holonplatform.core.Expression.InvalidExpressionException

      Specified by:
        `resolve` in interface `com.holonplatform.core.ExpressionResolver.ExpressionResolverHandler`
      Throws:
        `com.holonplatform.core.Expression.InvalidExpressionException`

    - #### addExpressionResolver

          public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void addExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)

      Specified by:
        `addExpressionResolver` in interface `com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport`

    - #### removeExpressionResolver

          public <E extends com.holonplatform.core.Expression,R extends com.holonplatform.core.Expression> void removeExpressionResolver(com.holonplatform.core.ExpressionResolver<E,R> expressionResolver)

      Specified by:
        `removeExpressionResolver` in interface `com.holonplatform.core.ExpressionResolver.ExpressionResolverSupport`

Copyright © 2019 The Holon Platform. All rights reserved.