org.apache.cayenne.velocity

## Class VelocitySQLTemplateProcessor

- java.lang.Object
- - org.apache.cayenne.velocity.VelocitySQLTemplateProcessor

- All Implemented Interfaces:
    SQLTemplateProcessor

      public class VelocitySQLTemplateProcessor
      extends Object
      implements SQLTemplateProcessor

  Processor for SQL velocity templates.
  Since:
    4.0
  See Also:
    `SQLTemplate`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SQLTemplateRenderingUtils` | `renderingUtils`
    `protected org.apache.velocity.runtime.RuntimeInstance` | `velocityRuntime`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VelocitySQLTemplateProcessor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SQLStatement` | `processTemplate(String template, List<Object> positionalParameters)` Builds and returns a SQLStatement based on SQL template String and a list of positional parameters.
    `SQLStatement` | `processTemplate(String template, Map<String,?> parameters)` Builds and returns a SQLStatement based on SQL template and a set of parameters.

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

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

- - ### Field Detail

    - #### velocityRuntime

          protected org.apache.velocity.runtime.RuntimeInstance velocityRuntime

    - #### renderingUtils

          protected SQLTemplateRenderingUtils renderingUtils

  - ### Constructor Detail

    - #### VelocitySQLTemplateProcessor

          public VelocitySQLTemplateProcessor()

  - ### Method Detail

    - #### processTemplate

          public SQLStatement processTemplate(String template,
                                              Map<String,?> parameters)

      Builds and returns a SQLStatement based on SQL template and a set of parameters. During rendering, VelocityContext exposes the following as variables: all parameters in the map, `SQLTemplateRenderingUtils` as a "helper" variable and SQLStatement object as "statement" variable.
      Specified by:
        `processTemplate` in interface `SQLTemplateProcessor`

    - #### processTemplate

          public SQLStatement processTemplate(String template,
                                              List<Object> positionalParameters)

      Description copied from interface: `SQLTemplateProcessor`
      Builds and returns a SQLStatement based on SQL template String and a list of positional parameters.
      Specified by:
        `processTemplate` in interface `SQLTemplateProcessor`

Copyright © 2001–2023 Apache Cayenne. All rights reserved.