directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject Re: DN API polishing
Date Thu, 05 Aug 2010 13:44:10 GMT
  On 8/5/10 2:56 PM, Francois wrote:
>> The iterator() and getRdns() are doing the exact same thing, which is
>> different from the getAll() mtehod : there return the inner RDNs in the
>> revert order.
>>
>> For instance, if we have a DN like 'dc=c, dc=b, dc=a', there each of
>> those three methods will return RDNs in the following order :
>> o getRdns() and iterator() :
>> 'dc=c' then 'dc=b' then 'dc=a'
>> o getAll() will do the opposite :
>> 'dc=a' then 'dc=b' then 'dc=c'
>>
>> I think that the iterator() method should behave as the getAll() method
>> does, and getRdns() should keep the internal order (as it simply return
>> the inner field storing the rdns.
>
>
> I'm not really sure we need the two... A reverse is really easy to do 
> if getRdns return a list, and as you said, there is no need to make DN 
> api heavier than needed...
well, there are cases you want to 'browse' the DN from right to left 
(for instance, when looking for a specific root) and sometime from left 
to right (when duplicating the internal RDN[] for other purposes), but I 
must admit it's more or less irrelevant for our users.

We may want to modify the getRdns() to return a Collection<RDN> 
(implementing the Unmodifiable interface), in the same order (ie right 
to left)
>
> About the return type, I would prefer to have a collection I could use 
> directly (a List, or even better an immutable list or a list of copies 
> of RDN) than an iterator.
Right now, getRdns() return a deep copy of the RDNs (not only you get a 
new List, but all the RDNs are cloned). This is where a Iterator() is 
interesting : you don't have to copy everything.

Plus the RDN should be immutable, alleviating the necessity to clone the 
RDNs...



-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com


Mime
View raw message