spring-projects / spring-projects/spring-ldap
Make NullDirContextProcessor a public class
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 375
- Forks
- 501
- Avg merge
- 6h 4m
- Merged PRs (30d)
- 63
Description
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)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating LdapTemplate and its private static nested NullDirContextProcessor class. Extract it into a normal public top-level class while preserving its DirContextProcessor behavior, then verify that callers can instantiate it for the conditional search pattern shown in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100