Description:
Implement equals and hashCode for the SearchRequest class.
Reason:
I am working on creating a cache to map SearchRequest objects to their corresponding LDAP responses to avoid unnecessary LDAP queries. However, the absence of equals and hashCode methods in the SearchRequest class makes it difficult to compare two SearchRequest instances effectively. This limitation prevents the use of SearchRequest as a key in the caching logic
Requirements
- equals should compare all relevant fields of SearchRequest (e.g., baseDN, scope, filter, attributes, etc.) to determine logical equivalence between two instances.
- hashCode should generate a consistent hash based on the same fields used in equals.
- Ensure the implementation adheres to the contract of equals and hashCode
Alternatives
- The SDK could provide caching options by default to avoid unnecessarily lookups. I suspect that this is a larger ask
- I may be able to use
toString() but that method is expected to be used for a different use case
Description:
Implement
equalsandhashCodefor the SearchRequest class.Reason:
I am working on creating a cache to map
SearchRequestobjects to their corresponding LDAP responses to avoid unnecessary LDAP queries. However, the absence ofequalsandhashCodemethods in theSearchRequestclass makes it difficult to compare twoSearchRequestinstances effectively. This limitation prevents the use of SearchRequest as a key in the caching logicRequirements
Alternatives
toString()but that method is expected to be used for a different use case