You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <lg...@mobilebox.pl> on 2004/06/27 12:40:03 UTC

JXTG and size() method

as size is a keyword in jexl, how can I issue a size() method on a 
java.util.Set?

-- 
Leszek Gawron                                      lgawron@mobilebox.pl



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Antonio Gallardo <ag...@agssa.net>.
Upayavira dijo:
> Just to throw this into the pot:
>
> I remember this question coming up on either dev or user list in the
> past. Probably around nov/dec last year. Christopher Oliver gave a
> sensible answer which explained how to get around this. But in my brief
> search I haven't found his message I'm afraid.
>
Thanks I will try the next weekend to find the mail.

Best Regards,

Antonio Gallardo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Upayavira <uv...@upaya.co.uk>.
Leszek Gawron wrote:

> Antonio Gallardo wrote:
>
>> Leszek Gawron dijo:
>>
>>> Antonio Gallardo wrote:
>>>
>>>
>>>> Leszek Gawron dijo:
>>>>
>>>>
>>>>> Stephan Coboos wrote:
>>>>>
>>>>>
>>>>>> Why not using ${mySet.size()} ? Doesn't it work?
>>>>>
>>>>>
>>>>> It does not .. it looks like some kind of reserved keyword.
>>>>
>>>>
>>>>
>>>> AFAIK it must work. Why do you think this is a reserved word?
>>>
>>>
>>> at least it is treated specially.
>>> Try to invoke a size method on a java.util.Set (HashSet for 
>>> example). In
>>> JXTG of course.
>>
>>
>>
>> why this method ca be special. I don't saw any "special case" for Set or
>> HashSet inside the code.
>>
>> I already use this:
>>
>> <jx:set var="sizeOfList" value="${bean.myList.size()}"/>
>
> because the list IS handled by ASTSizeFunction class. See JEXL sources.
>     lg
>
Just to throw this into the pot:

I remember this question coming up on either dev or user list in the 
past. Probably around nov/dec last year. Christopher Oliver gave a 
sensible answer which explained how to get around this. But in my brief 
search I haven't found his message I'm afraid.

Upayavira




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Antonio Gallardo wrote:
> Leszek Gawron dijo:
> 
>>Antonio Gallardo wrote:
>>
>>
>>>Leszek Gawron dijo:
>>>
>>>
>>>>Stephan Coboos wrote:
>>>>
>>>>
>>>>>Why not using ${mySet.size()} ? Doesn't it work?
>>>>
>>>>It does not .. it looks like some kind of reserved keyword.
>>>
>>>
>>>AFAIK it must work. Why do you think this is a reserved word?
>>
>>at least it is treated specially.
>>Try to invoke a size method on a java.util.Set (HashSet for example). In
>>JXTG of course.
> 
> 
> why this method ca be special. I don't saw any "special case" for Set or
> HashSet inside the code.
> 
> I already use this:
> 
> <jx:set var="sizeOfList" value="${bean.myList.size()}"/>
because the list IS handled by ASTSizeFunction class. See JEXL sources.
	lg

-- 
Leszek Gawron                                      lgawron@mobilebox.pl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Antonio Gallardo <ag...@agssa.net>.
Leszek Gawron dijo:
> Antonio Gallardo wrote:
>
>> Leszek Gawron dijo:
>>
>>>Stephan Coboos wrote:
>>>
>>>>Why not using ${mySet.size()} ? Doesn't it work?
>>>
>>>It does not .. it looks like some kind of reserved keyword.
>>
>>
>> AFAIK it must work. Why do you think this is a reserved word?
> at least it is treated specially.
> Try to invoke a size method on a java.util.Set (HashSet for example). In
> JXTG of course.

why this method ca be special. I don't saw any "special case" for Set or
HashSet inside the code.

I already use this:

<jx:set var="sizeOfList" value="${bean.myList.size()}"/>

The bean is a class that contains a List. The size method works fine. It
is not a keyword.

Best Regards,

Antonio Gallardo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Antonio Gallardo wrote:

> Leszek Gawron dijo:
> 
>>Stephan Coboos wrote:
>>
>>>Why not using ${mySet.size()} ? Doesn't it work?
>>
>>It does not .. it looks like some kind of reserved keyword.
> 
> 
> AFAIK it must work. Why do you think this is a reserved word?
at least it is treated specially.
Try to invoke a size method on a java.util.Set (HashSet for example). In 
JXTG of course.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Antonio Gallardo <ag...@agssa.net>.
Leszek Gawron dijo:
> Stephan Coboos wrote:
>> Why not using ${mySet.size()} ? Doesn't it work?
> It does not .. it looks like some kind of reserved keyword.

AFAIK it must work. Why do you think this is a reserved word?

Best Regards,

Antonio Gallardo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Stephan Coboos wrote:

> Leszek Gawron wrote:
> 
>> Conal Tuohy wrote:
>>
>>> Leszek Gawron wrote:
>>>
>>>
>>>> as size is a keyword in jexl, how can I issue a size() method on a 
>>>> java.util.Set?
>>>
>>>
>>>
>>>
>>> Can you use the xpath function "count()"?
>>
>>
>> No I can't. It looks like the hibernate lazy collection is not 
>> initialized in the first place and I get 0 every time I do it.
>>
>> I know already why this does not work ${size( collection )}. The 
>> collection has to be Map, List or Array (String also even though this 
>> is not a collection). Set was simply omitted so I have to provide a 
>> patch.
>>
> Why not using ${mySet.size()} ? Doesn't it work?
It does not .. it looks like some kind of reserved keyword.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Stephan Coboos <cr...@gmx.net>.
Leszek Gawron wrote:

> Conal Tuohy wrote:
>
>> Leszek Gawron wrote:
>>
>>
>>> as size is a keyword in jexl, how can I issue a size() method on a 
>>> java.util.Set?
>>
>>
>>
>> Can you use the xpath function "count()"?
>
> No I can't. It looks like the hibernate lazy collection is not 
> initialized in the first place and I get 0 every time I do it.
>
> I know already why this does not work ${size( collection )}. The 
> collection has to be Map, List or Array (String also even though this 
> is not a collection). Set was simply omitted so I have to provide a 
> patch.
>
Why not using ${mySet.size()} ? Doesn't it work?

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: JXTG and size() method

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Conal Tuohy wrote:
> Leszek Gawron wrote:
> 
> 
>>as size is a keyword in jexl, how can I issue a size() method on a 
>>java.util.Set?
> 
> 
> Can you use the xpath function "count()"?
No I can't. It looks like the hibernate lazy collection is not 
initialized in the first place and I get 0 every time I do it.

I know already why this does not work ${size( collection )}. The 
collection has to be Map, List or Array (String also even though this is 
not a collection). Set was simply omitted so I have to provide a patch.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: JXTG and size() method

Posted by Conal Tuohy <co...@paradise.net.nz>.
Leszek Gawron wrote:

> as size is a keyword in jexl, how can I issue a size() method on a 
> java.util.Set?

Can you use the xpath function "count()"?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org