org.springframework.ldap.core

## Class ContextMapperCallbackHandler<T>

- java.lang.Object
- - org.springframework.ldap.core.CollectingNameClassPairCallbackHandler<T>
  - - org.springframework.ldap.core.ContextMapperCallbackHandler<T>

- All Implemented Interfaces:
    NameClassPairCallbackHandler
  Direct Known Subclasses:
    ContextMapperCallbackHandlerWithControls, ContextMapperCallbackHandlerWithControls

      public class ContextMapperCallbackHandler<T>
      extends CollectingNameClassPairCallbackHandler<T>

  A CollectingNameClassPairCallbackHandler to wrap a ContextMapper. That is, the found object is extracted from each `Binding`, and then passed to the specified ContextMapper for translation.
  Since:
    1.2
  Author:
    Mattias Hellborg Arthursson, Ulrik Sandberg

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextMapperCallbackHandler(ContextMapper<T> mapper)` Constructs a new instance wrapping the supplied `ContextMapper`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `getObjectFromNameClassPair(NameClassPair nameClassPair)` Cast the NameClassPair to a `Binding` and pass its object to the ContextMapper.

    - ### Methods inherited from class org.springframework.ldap.core.CollectingNameClassPairCallbackHandler

      `getList, handleNameClassPair`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ContextMapperCallbackHandler

          public ContextMapperCallbackHandler(ContextMapper<T> mapper)

      Constructs a new instance wrapping the supplied `ContextMapper`.
      Parameters:
        `mapper` - the mapper to be called for each entry.

  - ### Method Detail

    - #### getObjectFromNameClassPair

          public T getObjectFromNameClassPair(NameClassPair nameClassPair)
                                       throws NamingException

      Cast the NameClassPair to a `Binding` and pass its object to the ContextMapper.
      Specified by:
        `getObjectFromNameClassPair` in class `CollectingNameClassPairCallbackHandler<T>`
      Parameters:
        `nameClassPair` - a Binding instance.
      Returns:
        the Object returned from the mapper.
      Throws:
        `NamingException` - if an error occurs.
        `ObjectRetrievalException` - if the object of the nameClassPair is null.