You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would be useful in the context of Spring Data to natively expose the LDAP result as stream without collecting results into a Collection. Since NamingEnumeration is closeable, the Stream needs to be closed after consumption but that is a regular requirement when used in other modules such as JdbcTemplate.queryForStream(…) or JPA stream queries.
How did you decide on those two methods? Several LdapTemplate methods return a List and could possibly benefit from a Stream equivalent. Or, IOW, I'm wondering if any other methods should be considered.
After some further analysis, it seems search(LdapQuery, ContextMapper<T>) is a better fit. Also, search(LdapQuery, AttributeMapper<T>) could benefit from a Stream option.
What I'd recommend are the following three new methods:
findStream/searchStream are going into the right direction. Maybe just stream for a less clunky name.
A method returning Stream and accepting ContextMapper seems weird at first sight (one could always call stream.map(mapper::mapFromContext) but given that mapFromContext can throw an exception, the design proposal makes sense.
It would be great if
LdapTemplate
could bridgeNamingEnumeration
into a Java 8Stream
exposing the following methods:This would be useful in the context of Spring Data to natively expose the LDAP result as stream without collecting results into a
Collection
. SinceNamingEnumeration
is closeable, theStream
needs to be closed after consumption but that is a regular requirement when used in other modules such asJdbcTemplate.queryForStream(…)
or JPA stream queries.#501 seems a related ticket.
The text was updated successfully, but these errors were encountered: