public abstract class AbstractUpcasterChain extends Object implements UpcasterChain
Modifier | Constructor and Description |
---|---|
protected |
AbstractUpcasterChain(ConverterFactory converterFactory,
List<Upcaster> upcasters)
Initializes the UpcasterChain with given
converterFactory and upcasters . |
protected |
AbstractUpcasterChain(List<Upcaster> upcasters)
Initializes the UpcasterChain with given
upcasters and a ChainingConverterFactory to
convert between content types. |
Modifier and Type | Method and Description |
---|---|
protected abstract <T> List<SerializedObject<?>> |
doUpcast(Upcaster<T> upcaster,
SerializedObject<?> sourceObject,
List<SerializedType> targetTypes,
UpcastingContext context)
Performs the actual upcasting by the given
upcaster on the given sourceObject . |
protected <S,T> SerializedObject<T> |
ensureCorrectContentType(SerializedObject<S> serializedObject,
Class<T> expectedContentType)
Converts, if necessary, the given
serializedObject , and returns a SerializedObject with given
expectedContentType . |
List<SerializedObject> |
upcast(SerializedObject serializedObject,
UpcastingContext upcastingContext)
Pass the given
serializedObject through the chain of upcasters. |
protected AbstractUpcasterChain(List<Upcaster> upcasters)
upcasters
and a ChainingConverterFactory
to
convert between content types.upcasters
- the upcasters to form the chainprotected AbstractUpcasterChain(ConverterFactory converterFactory, List<Upcaster> upcasters)
converterFactory
and upcasters
.converterFactory
- The factory providing the converters to convert between content typesupcasters
- The upcasters to form this chainpublic List<SerializedObject> upcast(SerializedObject serializedObject, UpcastingContext upcastingContext)
UpcasterChain
serializedObject
through the chain of upcasters. The result is a list of zero or
more serializedObjects representing the latest revision of the payload object.upcast
in interface UpcasterChain
serializedObject
- the serialized object to upcastupcastingContext
- the container of properties of the Message transporting the object being upcastprotected <S,T> SerializedObject<T> ensureCorrectContentType(SerializedObject<S> serializedObject, Class<T> expectedContentType)
serializedObject
, and returns a SerializedObject with given
expectedContentType
. If the serializedObject
already contains the given
expectedContentType
, it is returned as-is.S
- The content type of the provided SerializedObjectT
- The content type of the SerializedObject to returnserializedObject
- The object to convertexpectedContentType
- The content type of the SerializedObject to returnprotected abstract <T> List<SerializedObject<?>> doUpcast(Upcaster<T> upcaster, SerializedObject<?> sourceObject, List<SerializedType> targetTypes, UpcastingContext context)
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)
.T
- The representation type expected by the upcasterupcaster
- The upcaster to perform the upcasting withsourceObject
- The SerializedObject to upcasttargetTypes
- The types expected in the returned List of SerializedObjectcontext
- The container of properties of the Domain Event Message being upcastsourceObject
Copyright © 2010-2014. All Rights Reserved.