public abstract class AbstractContextMapper<T> extends Object implements ContextMapper<T>
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 and Description |
---|
AbstractContextMapper() |
Modifier and Type | Method and Description |
---|---|
protected abstract T |
doMapFromContext(DirContextOperations ctx)
Map a single
DirContextOperation to an object. |
T |
mapFromContext(Object ctx)
Map a single LDAP Context to an object.
|
public final T mapFromContext(Object ctx)
ctx
is the object from a single SearchResult
,
Binding
, or a lookup operation.mapFromContext
in interface ContextMapper<T>
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
.ClassCastException
- if a custom DirObjectFactory
implementation is
used, causing the objects passed in be anything else than
DirContextOperations
instances.protected abstract T doMapFromContext(DirContextOperations ctx)
DirContextOperation
to an object. The
supplied instance is the object supplied to
mapFromContext(Object)
cast to a
DirContextOperations
.ctx
- the context to map to an object.