Spring LDAP

org.springframework.ldap.core
Interface ContextMapper

All Known Subinterfaces:
ContextAssembler, ParameterizedContextMapper<T>, ParameterizedContextMapperWithControls<T>
All Known Implementing Classes:
AbstractContextMapper, AbstractParameterizedContextMapper, AttributeCheckContextMapper, LdapEntryIdentificationContextMapper

public interface ContextMapper

An interface used by LdapTemplate to map LDAP Contexts to beans. When a DirObjectFactory is set on the ContextSource, the objects returned from search and listBindings operations are automatically transformed to DirContext objects (when using the DefaultDirObjectFactory - which is typically the case, unless something else has been explicitly specified - you get a DirContextAdapter object). This object will then be passed to the ContextMapper implementation for transformation to the desired bean.

ContextMapper implementations are typically stateless and thus reusable; they are ideal for implementing mapping logic in one place.

Alternatively, consider using an AttributesMapper in stead.

Author:
Mattias Hellborg Arthursson
See Also:
LdapTemplate.search(Name, String, ContextMapper), LdapTemplate.listBindings(Name, ContextMapper), LdapTemplate.lookup(Name, ContextMapper), AttributesMapper, DefaultDirObjectFactory, DirContextAdapter, AbstractContextMapper

Method Summary
 Object mapFromContext(Object ctx)
          Map a single LDAP Context to an object.
 

Method Detail

mapFromContext

Object mapFromContext(Object ctx)
Map a single LDAP Context to an object. The supplied Object ctx is the object from a single SearchResult, Binding, or a lookup operation.

Parameters:
ctx - the context to map to an object. Typically this will be a DirContextAdapter instance, unless a project specific DirObjectFactory has been specified on the ContextSource.
Returns:
an object built from the data in the context.

Spring LDAP