Class AbstractContextMapper<T>
- java.lang.Object
-
- org.springframework.ldap.core.support.AbstractContextMapper<T>
-
- All Implemented Interfaces:
ContextMapper<T>
public abstract class AbstractContextMapper<T> extends java.lang.Object implements ContextMapper<T>
Abstract superclass that may be used instead of implementingContextMapperdirectly. Subclassing from this superclass, the supplied context will be automatically cast toDirContextOperations. Note that if you use your ownDirObjectFactory, this implementation will fail with aClassCastException.
-
-
Constructor Summary
Constructors Constructor Description AbstractContextMapper()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TdoMapFromContext(DirContextOperations ctx)Map a singleDirContextOperationto an object.TmapFromContext(java.lang.Object ctx)Map a single LDAP Context to an object.
-
-
-
Method Detail
-
mapFromContext
public final T mapFromContext(java.lang.Object ctx)
Map a single LDAP Context to an object. The supplied Objectctxis the object from a singleSearchResult,Binding, or a lookup operation.- Specified by:
mapFromContextin interfaceContextMapper<T>- Parameters:
ctx- the context to map to an object. Typically this will be aDirContextAdapterinstance, unless a project specificDirObjectFactoryhas been specified on theContextSource.- Returns:
- an object built from the data in the context.
- Throws:
java.lang.ClassCastException- if a customDirObjectFactoryimplementation is used, causing the objects passed in be anything else thanDirContextOperationsinstances.
-
doMapFromContext
protected abstract T doMapFromContext(DirContextOperations ctx)
Map a singleDirContextOperationto 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.
-
-