org.springframework.data.mapping

## Class TraversalContext

- java.lang.Object
- - org.springframework.data.mapping.TraversalContext

    public class TraversalContext
    extends Object

A context object for lookups of values for `PersistentPropertyPaths` via a `PersistentPropertyAccessor`. It allows to register functions to post-process the objects returned for a particular property, so that the subsequent traversal would rather use the processed object. This is especially helpful if you need to traverse paths that contain `Collection`s and `Map` that usually need indices and keys to reasonably traverse nested properties.

Since:
  2.2
Author:
  Oliver Drotbohm

### Constructor Summary

Constructors
Constructor and Description
`TraversalContext()`

### Method Summary

All Methods Instance Methods Concrete Methods
`TraversalContext` `registerCollectionHandler(PersistentProperty<?> property, Function<? super Collection<?>,Object> handler)` Registers a `Function` to handle `Collection` values for the given property.
`<T> TraversalContext` `registerHandler(PersistentProperty<?> property, Class<T> type, Function<? super T,Object> handler)` Registers the given `Function` to post-process values obtained for the given `PersistentProperty` for the given type.
`TraversalContext` `registerHandler(PersistentProperty<?> property, Function<Object,Object> handler)` Registers a `Function` to post-process values for the given property.
`TraversalContext` `registerListHandler(PersistentProperty<?> property, Function<? super List<?>,Object> handler)` Registers a `Function` to handle `List` values for the given property.
`TraversalContext` `registerMapHandler(PersistentProperty<?> property, Function<? super Map<?,?>,Object> handler)` Registers a `Function` to handle `Map` values for the given property.
`TraversalContext` `registerSetHandler(PersistentProperty<?> property, Function<? super Set<?>,Object> handler)` Registers a `Function` to handle `Set` values for the given property.

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

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

### Constructor Detail

#### TraversalContext

    public TraversalContext()

### Method Detail

#### registerHandler

    public TraversalContext registerHandler(PersistentProperty<?> property,
                                            Function<Object,Object> handler)

Registers a `Function` to post-process values for the given property.

Parameters:
  `property` - must not be null.
  `handler` - must not be null.
Returns:

#### registerCollectionHandler

    public TraversalContext registerCollectionHandler(PersistentProperty<?> property,
                                                      Function<? super Collection<?>,Object> handler)

Registers a `Function` to handle `Collection` values for the given property.

Parameters:
  `property` - must not be null.
  `handler` - must not be null.
Returns:

#### registerListHandler

    public TraversalContext registerListHandler(PersistentProperty<?> property,
                                                Function<? super List<?>,Object> handler)

Registers a `Function` to handle `List` values for the given property.

Parameters:
  `property` - must not be null.
  `handler` - must not be null.
Returns:

#### registerSetHandler

    public TraversalContext registerSetHandler(PersistentProperty<?> property,
                                               Function<? super Set<?>,Object> handler)

Registers a `Function` to handle `Set` values for the given property.

Parameters:
  `property` - must not be null.
  `handler` - must not be null.
Returns:

#### registerMapHandler

    public TraversalContext registerMapHandler(PersistentProperty<?> property,
                                               Function<? super Map<?,?>,Object> handler)

Registers a `Function` to handle `Map` values for the given property.

Parameters:
  `property` - must not be null.
  `handler` - must not be null.
Returns:

#### registerHandler

    public <T> TraversalContext registerHandler(PersistentProperty<?> property,
                                                Class<T> type,
                                                Function<? super T,Object> handler)

Registers the given `Function` to post-process values obtained for the given `PersistentProperty` for the given type.

Type Parameters:
  `T` - the type of the value to handle.
Parameters:
  `property` - must not be null.
  `type` - must not be null.
  `handler` - must not be null.
Returns: