If you return multiple values from your mapper, you should specify that in your List. Below I do so by choosing to return a String array from the mapper:
Code:
List<String[]> list = (List<String[]>) ldapTemplate.search(dn,
"(&(objectClass=users)(uid=test)(aaaReply=Fram ed-IP-Address=*))",
new AbstractContextMapper() {
protected Object doMapFromContext(DirContextOperations ctx) {
return ctx.getStringAttributes("aaaReply");
}
});
The same code, only using the type-safe SimpleLdapTemplate:
Code:
List<String[]> list = simpleLdapTemplate.search(dn,
"(&(objectClass=users)(uid=test)(aaaReply=Fram ed-IP-Address=*))",
new ParameterizedContextMapper<String[]>() {
public String[] mapFromContext(Object ctx) {
DirContextOperations adapter = (DirContextOperations) ctx;
return adapter.getStringAttributes("aaaReply");
}
});