[ 
https://issues.apache.org/jira/browse/JCR-1239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546246
 ] 

Marcel Reutegger commented on JCR-1239:
---------------------------------------

Julian wrote:
> The use case is to be able to display the number of members in a collection 
> without having to iterate through them. 

ah, now I see.

> JCR provides that ability (RangeIterator), but SPI doesn't (Iterator). I 
> think that's a problem. 

But even in JCR you need to get the iterator to get the size! Here's an 
alternative approach, why don't we design the SPI the way you described the use 
case? Introduce a size method on the NodeInfo (the collection), which returns 
the number of child nodes, or -1 if unknown.

> SPI: Return value of RepositoryService.getChildInfos
> ----------------------------------------------------
>
>                 Key: JCR-1239
>                 URL: https://issues.apache.org/jira/browse/JCR-1239
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-spi
>            Reporter: angela
>             Fix For: 1.4
>
>
> separate issue started by julian within issue #1166:
> RepositoryService.getChildInfos is defined to return an Iterator.
> this forces the caller to loop over all entries in order to detect the number 
> of child-nodes.
> currently the hierarchy is populated any way, but that could be a source for 
> future optimization.
> possible solutions:
> - change return value to RangeIterator
> - change return value to Collection (or Set).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to