Spring LDAP Framework

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 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 Hellborg Arthursson

Constructor Summary
AbstractContextMapper()
           
 
Method Summary
protected abstract  Object doMapFromContext(DirContextOperations ctx)
          Map a single DirContextOperation to an object.
 Object mapFromContext(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 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.

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:
ClassCastException - if a custom DirObjectFactory implementation is used, causing the objects passed in be anything else than DirContextOperations instances.

doMapFromContext

protected abstract 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.

Spring LDAP Framework

Copyright © 2005-2010 The Spring LDAP Framework. All Rights Reserved.