Class AbstractContextMapper<T>
java.lang.Object
org.springframework.ldap.core.support.AbstractContextMapper<T>
- All Implemented Interfaces:
ContextMapper<T>
Abstract superclass that may be used instead of implementing
ContextMapper
directly. Subclassing from this superclass, the supplied context will be automatically
cast to DirContextOperations
. Note that if you use your own
DirObjectFactory
, this implementation will fail with a
ClassCastException
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Map a singleDirContextOperation
to an object.final T
mapFromContext
(Object ctx) Map a single LDAP Context to an object.
-
Constructor Details
-
AbstractContextMapper
public AbstractContextMapper()
-
-
Method Details
-
mapFromContext
Map a single LDAP Context to an object. The supplied Objectctx
is the object from a singleSearchResult
,Binding
, or a lookup operation.- Specified by:
mapFromContext
in interfaceContextMapper<T>
- Parameters:
ctx
- the context to map to an object. Typically this will be aDirContextAdapter
instance, unless a project specificDirObjectFactory
has been specified on theContextSource
.- Returns:
- an object built from the data in the context.
- Throws:
ClassCastException
- if a customDirObjectFactory
implementation is used, causing the objects passed in be anything else thanDirContextOperations
instances.
-
doMapFromContext
Map a singleDirContextOperation
to an object. The supplied instance is the object supplied tomapFromContext(Object)
cast to aDirContextOperations
.- Parameters:
ctx
- the context to map to an object.- Returns:
- an object built from the data in the context.
-