[stringtemplate-interest] IDE support and an issue with a nested list of Java objects
Shane Witbeck
shane at digitalsanctum.com
Mon Jan 15 20:59:43 PST 2007
Although I've had some help from Terence, I'm still having an issue with the
first of my two questions. I'm iterating over a list of "table" objects and
for each table object I have a list of column objects.
His solution was something like this:
$tables:{
public $it.capitalizedName$ get$it.capitalizedName$(int id) throws
DataAccessException {
String sql = "select $it.columns{c | $c.lowerName()$}; separator=", "$
from $it.allLowerName$ where ID = ?";
I think he made the assumption that c.lowerName() is a call to a nested
template. What I really need it to do is to invoke a "lowerName()" method on
the column object like I'm doing in the iteration of tables above it. Not
sure if I'm unaware of a limitation or if I have the syntax wrong.
Thanks again.
On 1/14/07, Shane Witbeck <shane at digitalsanctum.com> wrote:
>
> Two questions:
>
> 1. Is there a "File Type" definition or plugin available for
> StringTemplate somewhere which gives highlighting support for the IntelliJ
> IDEA IDE? If not, which IDE has the best support for working with templates?
>
>
> 2. I'm getting the string representation of a nested object list instead
> of the value of the method I'm calling.
>
> Here's the code in question:
>
> $tables:{
> public $it.capitalizedName$ get$it.capitalizedName$(int id) throws
> DataAccessException {
> String sql = "select $it.columns; separator=", ":{
> $it.capitalizedName$ }$ from $it.allLowerName$ where ID = ?";
>
> which generates this:
>
> public Attribute getAttribute(int id) throws DataAccessException {
> String sql = "select
> com.digitalsanctum.tools.DomainGenerator$Column at 125d06e,
> com.digitalsanctum.tools.DomainGenerator$Column at 196f4b5 from attribute
> where ID = ?";
>
> tables is a List<Table> and columns (List<Column>) is a member variable of
> a Table object.
>
> TIA
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070115/242f86da/attachment.html
More information about the stringtemplate-interest
mailing list