public List<MyMap> getRows() {...}

Davor Hrg wrote:
how is getRows declared in your page class ?




On Tue, Apr 1, 2008 at 2:09 PM, Michael Kolmodin <[EMAIL PROTECTED]>
wrote:

OK, thanks...

In my page, I have <t:myComponent columns="prop:columns"
rows="prop:rows"/>

The columns argument, a List<String> is just fine.
The rows argument, a List<MyMap> is the problem.

The page has a List<MyMap> getRows() which is verified.

Looking in MyComponent.java, I have

   @Parameter
    private List<MyMap>  rows;

    @Parameter
    private List<String> columns;

public String getSomethingStrange()
{
    return rows.get(0).get( "mail" );
}

The latter getter fails. The debug info is from a breakpoint inside this
method. The error I get is a classcast error "java.lang.String cannot be
cast to ...MyMap" If I change the index to 1, there  an error "Caused
by: Index: 1, Size: 1" i. e., index out of bounds.

Davor Hrg wrote:
Tapestry support for Java generics is very limited,
you need a value encoder to make this work,

also, add more details on who calls what... so more is known
of the problem you are trying to solve.


Davor Hrg

On Tue, Apr 1, 2008 at 1:43 PM, Alec Leamas <[EMAIL PROTECTED]>
wrote:
I have problems passing my own datatype(s) to my own component. The
component takes two parameters, one List<String> and one List<MyMap>.
MyMap is declared as MyMap extends TreeMap {...}.

The first parameter, a list of strings arrives safely to my component.
However, the other one, seems to be mixed up: when I try to access an
element in my List<MyMap>, it turns out that Tapestry (nothing else
involved)  have filled  this list with String items, not the expected
MyMap items. In the end, there is a class cast exception when trying to
access the MyMap items as Maps.

In the Eclipse debugger, it seems that the value of the List<MyMap>
instance variable is a single string holding what looks like  the
serialized value of my List<MyMap>  list. The start is
"[{key=value,key=value...

I've tried to contribute coercions between MyMap<->Map, but this desn't
seem to help (?).

Basically, I'm stucked unless I write everything in several big pages
with duplicated code. Don't really want to do that. :-(

Any hints out there?

--alec

PS  Version: 5.0.11 DS

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
--------------------------------------------------------------------------
Michael Kolmodin                        Fredsgatan 2
Phone:  +46 920 269413                  S-972 35 Lulea
Mobile  +46 70 551 6507                 Sweden

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to