org.springframework.ldap.core.support
Class AbstractContextMapper

java.lang.Object
  extended by org.springframework.ldap.core.support.AbstractContextMapper
All Implemented Interfaces:
ContextMapper

public abstract class AbstractContextMapper
extends java.lang.Object
implements ContextMapper

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.

Author:
Mattias Arthursson

Constructor Summary
AbstractContextMapper()
           
 
Method Summary
protected abstract  java.lang.Object doMapFromContext(DirContextOperations ctx)
          Map a single DirContextOperation to an object.
 java.lang.Object mapFromContext(java.lang.Object ctx)
          Map a single LDAP Context to an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContextMapper

public AbstractContextMapper()
Method Detail

mapFromContext

public final java.lang.Object mapFromContext(java.lang.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.

Specified by:
mapFromContext in interface ContextMapper
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.
Throws:
java.lang.ClassCastException - if a custom DirObjectFactory implementation is used, causing the objects passed in be anything else than DirContextOperations instances.

doMapFromContext

protected abstract java.lang.Object doMapFromContext(DirContextOperations ctx)
Map a single DirContextOperation to an object. The supplied instance is the object supplied to mapFromContext(Object) cast to a DirContextOperations.

Parameters:
ctx - the context to map to an object.
Returns:
an object built from the data in the context.


Copyright (c) 2005-2007. All Rights Reserved.