On Thu, Apr 28, 2011 at 4:23 PM, Emmanuel Lecharny <[email protected]>wrote:
> FYI, UnboundiD SDK has another approach : > http://www.unboundid.com/products/ldap-sdk/docs/javadoc/index.html > > 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()); > writer.writeEntry(entry); > } > else > { > // Got a continuation reference. > final SearchResultReference ref = reader.readReference(); > writer.writeComment("Search result reference:" + > ref.getURIs().toString()); > } > } > writer.flush(); > } > > Food for thoughts.. This is similar to using .next() then using the isXxxx() method to use a different accessor to the underlying data type. Regards, Alex
