public class BindDirective
extends org.apache.velocity.runtime.directive.Directive
#bind(value) - e.g. #bind($xyz) #bind(value jdbc_type_name) - e.g. #bind($xyz 'VARCHAR'). This is the most common and useful form. #bind(value jdbc_type_name, scale) - e.g. #bind($xyz 'VARCHAR' 2)
Other examples:
Binding literal parameter value:
 "WHERE SOME_COLUMN > #bind($xyz)" produces
 "WHERE SOME_COLUMN > ?" and also places the value of the
 "xyz" parameter in the context "bindings" collection.
 
Binding ID column of a DataObject value:
 "WHERE ID_COL1 = #bind($helper.cayenneExp($xyz, 'db:ID_COL2')) 
 AND ID_COL2 = #bind($helper.cayenneExp($xyz, 'db:ID_COL2'))" produces
 "WHERE ID_COL1 = ? AND ID_COL2 = ?" and also places the values
 of id columns of the DataObject parameter "xyz" in the context "bindings"
 collection.
 
| Constructor and Description | 
|---|
| BindDirective() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | bind(org.apache.velocity.context.InternalContextAdapter context,
    ParameterBinding binding)Adds value to the list of bindings in the context. | 
| protected Object | getChild(org.apache.velocity.context.InternalContextAdapter context,
        org.apache.velocity.runtime.parser.node.Node node,
        int i) | 
| String | getName() | 
| int | getType() | 
| boolean | render(org.apache.velocity.context.InternalContextAdapter context,
      Writer writer,
      org.apache.velocity.runtime.parser.node.Node node)Extracts the value of the object property to render and passes control to
  render(InternalContextAdapter, Writer, ParameterBinding)to do
 the actual rendering. | 
| protected void | render(org.apache.velocity.context.InternalContextAdapter context,
      Writer writer,
      org.apache.velocity.runtime.parser.node.Node node,
      Object value,
      String typeString,
      int scale) | 
| protected void | render(org.apache.velocity.context.InternalContextAdapter context,
      Writer writer,
      ParameterBinding binding) | 
public String getName()
getName in class org.apache.velocity.runtime.directive.Directivepublic int getType()
getType in class org.apache.velocity.runtime.directive.Directivepublic boolean render(org.apache.velocity.context.InternalContextAdapter context,
                      Writer writer,
                      org.apache.velocity.runtime.parser.node.Node node)
               throws IOException,
                      org.apache.velocity.exception.ResourceNotFoundException,
                      org.apache.velocity.exception.ParseErrorException,
                      org.apache.velocity.exception.MethodInvocationException
render(InternalContextAdapter, Writer, ParameterBinding) to do
 the actual rendering.render in class org.apache.velocity.runtime.directive.DirectiveIOExceptionorg.apache.velocity.exception.ResourceNotFoundExceptionorg.apache.velocity.exception.ParseErrorExceptionorg.apache.velocity.exception.MethodInvocationExceptionprotected void render(org.apache.velocity.context.InternalContextAdapter context,
                      Writer writer,
                      org.apache.velocity.runtime.parser.node.Node node,
                      Object value,
                      String typeString,
                      int scale)
               throws IOException,
                      org.apache.velocity.exception.ParseErrorException
IOExceptionorg.apache.velocity.exception.ParseErrorExceptionprotected void render(org.apache.velocity.context.InternalContextAdapter context,
                      Writer writer,
                      ParameterBinding binding)
               throws IOException
IOExceptionprotected Object getChild(org.apache.velocity.context.InternalContextAdapter context, org.apache.velocity.runtime.parser.node.Node node, int i) throws org.apache.velocity.exception.MethodInvocationException
org.apache.velocity.exception.MethodInvocationExceptionprotected void bind(org.apache.velocity.context.InternalContextAdapter context,
                    ParameterBinding binding)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.