org.axonframework.upcasting
Class LazyUpcasterChain
java.lang.Object
org.axonframework.upcasting.AbstractUpcasterChain
org.axonframework.upcasting.LazyUpcasterChain
- All Implemented Interfaces:
- UpcasterChain
public class LazyUpcasterChain
- extends AbstractUpcasterChain
UpcasterChain implementation that delays the actual upcasting until the data inside the returned SerializedObject is
actually fetched. This makes this implementation perform better in cases where not all events are used.
Ordering guarantees:
This upcasterChain only guarantees that for each of the configured upcasters, all previous upcasters have had the
opportunity to upcast the SerializedObject first. This UpcasterChain does not guarantee that, for each
upcaster, all events are upcast in the order they are provided in the stream.
Note that this implementation is not suitable if you require each upcaster to upcast all events in a stream in
order. See SimpleUpcasterChain instead for these cases.
- Since:
- 2.0
- Author:
- Allard Buijze
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LazyUpcasterChain
public LazyUpcasterChain(List<Upcaster> upcasters)
- Initializes the UpcasterChain with given
upcasters and a ChainingConverterFactory to
convert between content types.
- Parameters:
upcasters - the upcasters to form the chain
LazyUpcasterChain
public LazyUpcasterChain(ConverterFactory converterFactory,
List<Upcaster> upcasters)
- Initializes the UpcasterChain with given
converterFactory and upcasters.
- Parameters:
converterFactory - The factory providing the converters to convert between content typesupcasters - The upcasters to form this chain
doUpcast
protected <T> List<SerializedObject<?>> doUpcast(Upcaster<T> upcaster,
SerializedObject<?> sourceObject,
List<SerializedType> targetTypes)
- Description copied from class:
AbstractUpcasterChain
- Performs the actual upcasting by the given
upcaster on the given sourceObject. The
returned list of serialized object must represent the upcast version of the given sourceObject.
Each item in the returned List of SerializedObject must match the given list of targetTypes. These
types are returned by the invocation of Upcaster.upcast(org.axonframework.serializer.SerializedType).
- Specified by:
doUpcast in class AbstractUpcasterChain
- Type Parameters:
T - The representation type expected by the upcaster- Parameters:
upcaster - The upcaster to perform the upcasting withsourceObject - The SerializedObject to upcasttargetTypes - The types expected in the returned List of SerializedObject
- Returns:
- The List of SerializedObject representing the upcast
sourceObject
Copyright © 2010-2012. All Rights Reserved.