[stringtemplate-interest] Newby question on lists
Wolfgang Ponikwar
woponikwar at ib-ponikwar.de
Fri Sep 5 08:23:24 PDT 2008
Hi,
I am sorry, but please disregard my previoous mail. It seems like I
should have thought more deeply before writing the mail. I have found my
mistake just a minute after I have sent the message.
Again, sorry for bothering.
Kind regards,
Wolfgang
Wolfgang Ponikwar schrieb:
> Hi,
>
> I have just started with StringTemplate, so my question might be very
> simple. I have tried to figure out how to access a Java List as an
> attribute of a class. The situation seems simple:
> I have two classes, Foo and Bar, where Foo holds a list of Bars and Bar
> holds another list of X.
> class Foo {
> List<Bar> bars;
> ...
> }
> class Bar {
> List<X> members;
> ...
> }
>
> I pass my Object foo to StringTemplate using setAttribute(...),
> resulting in the contained Bar instances being flattened and applied to
> the template. That works nicely. When I then pass one Bar instance
> inside this template to another template from a separate file and
> attempt to access any of the X members like:
> $it.members:template()$
> I get no output. Testing multivalued nature using
> $length(it.members)$
> gives me 1 for the singular List instance.
> I was expecting to get the number of elements in the list, just as if I
> had passed the list to the template via setAttribute(...).
> I must admit, I am quite confused, especialy, since I could not find a
> single working example.
> I have been browsing the list archive, but my question must be so simple
> that I did not find any thread on this subject.
> I gues, I must be making a stupid mistake?
>
> Any help really apreciated.
>
> Kind regards,
>
>
--
Wolfgang Ponikwar
_______________________________________
Ingenieurbüro Ponikwar
Kirchenstrasse 5
85630 Grasbrunn, Deutschland
Tel. : +49 (0)89 46 20 02 70
Fax : +49 (0)89 46 20 02 71
Mobil : +49 (0)170 6 34 19 20
Skype : wolfgang.ponikwar
E-Mail: woponikwar at ib-ponikwar.de
www.ib-ponikwar.de
More information about the stringtemplate-interest
mailing list