[ 
https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926625#action_12926625
 ] 

Felix Knecht commented on DIRSERVER-1294:
-----------------------------------------

It depends on which Cursor you mainly have thought of. Following Cursors can be 
implemented IMO:

- EntryToResponseCursor (ApacheDS)
- CursorList (Shared)
- EmptyCursor (Shared)
- ListCursor (Shared)
- SingletonCursor (Shared)

Partially:
- SearchCursorImpl (Shared)

Not:
- BaseEntryFilteringCursor (ApacheDS)

So the question is 'What to do?'

1. Just close the issue as 'Won't fix'
2. Implement where possible and otherwise throw an UnsupportedOperationException
3. Create a 'Interface CursorPlus extends Cursor<E>' and implement this 
interface where the functions 'size(), hasNext(), hasPrevious()' are 
implementable.

I feel bad for solution 2 because it throws an Exception -> a developer has to 
trap in the first time before realising that it's not possible to use it...

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() 
> methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control 
> contains the expected size. The hasNext() method could help to avoid a next() 
> and previous() calls to check if we have one more entry available in the 
> cursor.

-- 
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