Interface LDAPSearchResult
-
public interface LDAPSearchResult
Represents the result of an LDAP search operation.- See Also:
LDAPProvider.sendRequest(LDAPRequest)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Iterator<LDAPEntry>
entriesIterator()
Returns an iterator over the set of the matching entries for the search operation.int
getCount()
Returns the number of matching entries for the search operation.LDAPEntry
getEntry()
Returns the single matching entry returned for the search operation.LDAPEntry
getEntry(String dn)
Returns the matching entry with the specified DN from the set of entries for the search operation.LDAPEntry
getFirstEntry()
Returns the first entry from the set of entries for the search operation.
-
-
-
Method Detail
-
getCount
int getCount()
Returns the number of matching entries for the search operation.- Returns:
- the number of matching entries for the search operation.
-
getEntry
LDAPEntry getEntry() throws LDAPException
Returns the single matching entry returned for the search operation.Note that if the search result contains more than one entry, an LDAPException will be thrown. It is recommended to check the result count before making calls of this method. In case there will be more than one entry returned for the search operation, use entries iterator instead.
- Returns:
- the single matching entry returned for the search operation, or null if no entries returned for the search operation.
- Throws:
LDAPException
- if more than one entry returned for the search operation.
-
getEntry
LDAPEntry getEntry(String dn) throws LDAPException
Returns the matching entry with the specified DN from the set of entries for the search operation.- Parameters:
dn
- the DN of the entry to retrieve from the set of matching entries returned for the search operation. It must not be null.- Returns:
- the matching entry with the provided DN, or null if the specified entry was not returned for the search operation.
- Throws:
LDAPException
- if failed to parse the provided DN or a search entry DN.
-
getFirstEntry
LDAPEntry getFirstEntry()
Returns the first entry from the set of entries for the search operation.Note that this method was added for convenience and should be used with care, only when the number / order of matching entries for the search operation is irrelevant. In other cases, use either
getEntry()
for expected single matching entry result orentriesIterator()
if more than one entry result expected.- Returns:
- the first entry from the set of entries returned for the search operation, or null if no entries returned for the search operation.
- See Also:
getEntry()
,entriesIterator()
-
-