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.Directive
public int getType()
getType
in class org.apache.velocity.runtime.directive.Directive
public 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.Directive
IOException
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
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) throws IOException, org.apache.velocity.exception.ParseErrorException
IOException
org.apache.velocity.exception.ParseErrorException
protected void render(org.apache.velocity.context.InternalContextAdapter context, Writer writer, ParameterBinding binding) throws IOException
IOException
protected 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.MethodInvocationException
protected void bind(org.apache.velocity.context.InternalContextAdapter context, ParameterBinding binding)
Copyright © 2001–2017 Apache Cayenne. All rights reserved.