public class TraversalContext extends Object
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.Constructor and Description |
---|
TraversalContext() |
public TraversalContext registerHandler(PersistentProperty<?> property, Function<Object,Object> handler)
Function
to post-process values for the given property.property
- must not be null.handler
- must not be null.public TraversalContext registerCollectionHandler(PersistentProperty<?> property, Function<? super Collection<?>,Object> handler)
Function
to handle Collection
values for the given property.property
- must not be null.handler
- must not be null.public TraversalContext registerListHandler(PersistentProperty<?> property, Function<? super List<?>,Object> handler)
property
- must not be null.handler
- must not be null.public TraversalContext registerSetHandler(PersistentProperty<?> property, Function<? super Set<?>,Object> handler)
property
- must not be null.handler
- must not be null.public TraversalContext registerMapHandler(PersistentProperty<?> property, Function<? super Map<?,?>,Object> handler)
property
- must not be null.handler
- must not be null.public <T> TraversalContext registerHandler(PersistentProperty<?> property, Class<T> type, Function<? super T,Object> handler)
Function
to post-process values obtained for the given PersistentProperty
for
the given type.T
- the type of the value to handle.property
- must not be null.type
- must not be null.handler
- must not be null.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.