org.axonframework.upcasting
Interface ExtendedUpcaster<T>

Type Parameters:
T - The data format that this upcaster uses to represent the event
All Superinterfaces:
Upcaster<T>

public interface ExtendedUpcaster<T>
extends Upcaster<T>

Extension of the Upcaster interface that allows type upcasting to be based on the contents of the serialized object. UpcasterChain implementations should invoke the upcast(org.axonframework.serializer.SerializedType, org.axonframework.serializer.SerializedObject) on upcasters that implement this interface, instead of upcast(org.axonframework.serializer.SerializedType)

Since:
2.2
Author:
Allard Buijze

Method Summary
 List<SerializedType> upcast(SerializedType serializedType)
          Upcast the given serializedType into its new format.
 List<SerializedType> upcast(SerializedType serializedType, SerializedObject<T> intermediateRepresentation)
          Upcast the given serializedType into its new format.
 
Methods inherited from interface org.axonframework.upcasting.Upcaster
canUpcast, expectedRepresentationType, upcast
 

Method Detail

upcast

List<SerializedType> upcast(SerializedType serializedType,
                            SerializedObject<T> intermediateRepresentation)
Upcast the given serializedType into its new format. Generally, this involves increasing the revision. Sometimes, it is also necessary to alter the type's name (in case of a renamed class, for example). The order and the size of the list returned has to match with the order and size of the list of the upcast IntermediateRepresentations by this upcaster.

Unlike the upcast(org.axonframework.serializer.SerializedType) method, this gives you access to the serialized object to upcast. This may be used to choose the SerializedType based on the contents of a Message's payload.

Implementations aware of the ExtendedUpcaster interface must use this method instead of upcast(org.axonframework.serializer.SerializedType)

Parameters:
serializedType - The serialized type to upcast
intermediateRepresentation - The intermediate representation of the object to define the type for
Returns:
the upcast serialized type

upcast

List<SerializedType> upcast(SerializedType serializedType)
Upcast the given serializedType into its new format. Generally, this involves increasing the revision. Sometimes, it is also necessary to alter the type's name (in case of a renamed class, for example). The order and the size of the list returned has to match with the order and size of the list of the upcast IntermediateRepresentations by this upcaster.

To base the type on the actual contents of the Serialized Object, implement the ExtendedUpcaster interface instead.

Implementing this method is optional.

Specified by:
upcast in interface Upcaster<T>
Parameters:
serializedType - The serialized type to upcast
Returns:
the upcast serialized type
Throws:
UnsupportedOperationException - if the implementation requires the intermediate representation to upcast the serialized type.
See Also:
upcast(org.axonframework.serializer.SerializedType, org.axonframework.serializer.SerializedObject)


Copyright © 2010-2016. All Rights Reserved.