public class ResultDirective
extends org.apache.velocity.runtime.directive.Directive
#result(column_name) - e.g. #result('ARTIST_ID')
#result(column_name java_type) - e.g. #result('ARTIST_ID' 'String')
#result(column_name java_type column_alias) - e.g. #result('ARTIST_ID' 'String' 'ID')
#result(column_name java_type column_alias data_row_key) - e.g. #result('ARTIST_ID' 'String' 'ID' 'toArtist.ID')
'data_row_key' is needed if SQL 'column_alias' is not appropriate as a DataRow key on the Cayenne side. One common case when this happens is when a DataRow retrieved from a query is mapped using joint prefetch keys. In this case DataRow must use DB_PATH expressions for joint column keys, and their format is incompatible with most databases alias format.
Most common Java types used in JDBC can be specified without a package. This includes all numeric types, primitives, String, SQL dates, BigDecimal and BigInteger.
| Constructor and Description |
|---|
ResultDirective() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
bindResult(org.apache.velocity.context.InternalContextAdapter context,
ColumnDescriptor columnDescriptor)
Adds value to the list of result columns in the context.
|
protected Object |
getChild(org.apache.velocity.context.InternalContextAdapter context,
org.apache.velocity.runtime.parser.node.Node node,
int i) |
protected String |
getChildAsString(org.apache.velocity.context.InternalContextAdapter context,
org.apache.velocity.runtime.parser.node.Node node,
int i)
Returns a directive argument at a given index converted to String.
|
String |
getName() |
int |
getType() |
protected String |
guessType(String type)
Converts "short" type notation to the fully qualified class name.
|
boolean |
render(org.apache.velocity.context.InternalContextAdapter context,
Writer writer,
org.apache.velocity.runtime.parser.node.Node node) |
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 in class org.apache.velocity.runtime.directive.DirectiveIOExceptionorg.apache.velocity.exception.ResourceNotFoundExceptionorg.apache.velocity.exception.ParseErrorExceptionorg.apache.velocity.exception.MethodInvocationExceptionprotected 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 String getChildAsString(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 String guessType(String type)
protected void bindResult(org.apache.velocity.context.InternalContextAdapter context,
ColumnDescriptor columnDescriptor)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.