Interface Upcaster<T>
- Type Parameters:
T- The data format that this upcaster uses to represent the data
- All Known Subinterfaces:
EventUpcaster
- All Known Implementing Classes:
ContextAwareEventMultiUpcaster,ContextAwareSingleEntryMultiUpcaster,ContextAwareSingleEntryUpcaster,ContextAwareSingleEventUpcaster,EventMultiUpcaster,EventTypeUpcaster,EventUpcasterChain,GenericUpcasterChain,NoOpEventUpcaster,SingleEntryMultiUpcaster,SingleEntryUpcaster,SingleEventUpcaster
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for Upcasters. An upcaster is the mechanism used to convert deprecated (typically serialized) objects and
convert them into the current format. If the serializer itself is not able to cope with the changed formats (XStream,
for example, will allow for some changes by using aliases), the Upcaster will allow you to configure more complex
structural transformations.
Upcasters work on intermediate representations of the object to upcast. In some cases, this representation contains a
byte array, while in other cases they contain an object structure. For performance reasons, it is advisable to ensure
that all upcasters in the same upcaster chain (where one's output is another's input) use the same intermediate
representation content type.
- Since:
- 3.0
- Author:
- Rene de Waele
-
Method Summary
-
Method Details
-
upcast
Apply 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.
- Parameters:
intermediateRepresentations- The input stream of representations of objects- Returns:
- the output stream of representations after applying the upcast function
-