On Thu, Apr 28, 2011 at 4:23 PM, Emmanuel Lecharny <elecharny@gmail.com> wrote:
FYI, UnboundiD SDK has another approach :

OpenDS/DJ does things this way :

     final  ConnectionEntryReader reader =
         connection.search("dc=example,dc=com", SearchScope.WHOLE_SUBTREE,"(uid=bjensen)","*");
     while  (reader.hasNext())
       if  (!reader.isReference())
         // Got an entry.
         final  SearchResultEntry entry = reader.readEntry();
         writer.writeComment("Search result entry:"  + entry.getName().toString());
         // Got a continuation reference.
         final  SearchResultReference ref = reader.readReference();
         writer.writeComment("Search result reference:"  + ref.getURIs().toString());

Food for thoughts..

This is similar to using .next() then using the isXxxx() method to use a different accessor to the underlying data type.