Class SingleEntryUpcaster<T>
java.lang.Object
org.axonframework.serialization.upcasting.SingleEntryUpcaster<T>
- All Implemented Interfaces:
Upcaster<T>
- Direct Known Subclasses:
SingleEventUpcaster
Abstract implementation of an
Upcaster that eases the common process of upcasting one intermediate
representation to another representation by applying a simple mapping function to the input stream of intermediate
representations.- Since:
- 3.0
- Author:
- Rene de Waele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanChecks if this upcaster can upcast the givenintermediateRepresentation.protected abstract TUpcasts the givenintermediateRepresentation.Apply this upcaster to a stream ofintermediateRepresentationsand return the altered stream.
-
Constructor Details
-
SingleEntryUpcaster
public SingleEntryUpcaster()
-
-
Method Details
-
upcast
Description copied from interface:UpcasterApply this upcaster to a stream ofintermediateRepresentationsand return the altered stream.To upcast an object an upcaster should apply a mapping function to the input stream (
Stream.map(java.util.function.Function)). To remove an object from the stream the upcaster should filter the input stream (Stream.filter(java.util.function.Predicate)). To split an input object into more than one objects useStream.flatMap(java.util.function.Function).In some cases the upcasting result of an Upcaster may depend on more than one input object. In that case an Upcaster may store state in the method during upcasting or even read ahead in the stream.
-
canUpcast
Checks if this upcaster can upcast the givenintermediateRepresentation. If the upcaster cannot upcast the representation thedoUpcast(Object)is not invoked.- Parameters:
intermediateRepresentation- the intermediate object representation to upcast- Returns:
trueif the representation can be upcast,falseotherwise
-
doUpcast
Upcasts the givenintermediateRepresentation. This method is only invoked ifcanUpcast(Object)returnedtruefor the given representation.Note that the returned representation should not be
null. To remove an intermediateRepresentation add a filter to the input stream.- Parameters:
intermediateRepresentation- the representation of the object to upcast- Returns:
- the upcasted representation
-