Closed rwinch closed 11 years ago
Migrated from LDAP-272
Currently NullDirContextProcessor is a private static nested class of LdapTemplate. I would like to see it as a normal top-level public class.
The reason is that sometimes rather then writing
public List mySearch(String filter, boolean fancySearch) { if (fancySearch) { return this.ldapTemplate.search(this.defaultSearchBase, filter, SearchControls.SUBTREE_SCOPE, this.mapper, new FancyControlsDirContextProcessor()) } else { return this.ldapTemplate.search(this.defaultSearchBase, filter, this.mapper); } }
it would be more readable and maintainable (less copy-and-paste) to write
public List mySearch(String filter, boolean fancySearch) { DirContextProcessor dirContextProcessor = fancySearch ? new FancyControlsDirContextProcessor() : new NullDirContextProcessor(); return this.ldapTemplate.search(this.defaultSearchBase, filter, SearchControls.SUBTREE_SCOPE, this.mapper, dirContextProcessor) }
Mattias Hellborg Arthursson said:
Made the class public. It's still nested though.
Migrated from LDAP-272
Currently NullDirContextProcessor is a private static nested class of LdapTemplate. I would like to see it as a normal top-level public class.
The reason is that sometimes rather then writing
it would be more readable and maintainable (less copy-and-paste) to write