Hi,
I created some events then noticed that they were in the wrong folder. When I displaced them to the right folder, I got an UnknownSerializedTypeException. XStream doesn’t recognize the events any longer.
I tried writing an upcaster, which is not seen at run time. I don’t know if this is correct:
`
private static SimpleSerializedType targetType = new SimpleSerializedType(
"event.old.path", "1.0");
@Override
protected boolean canUpcast(IntermediateEventRepresentation intermediateRepresentation) {
return intermediateRepresentation.getType().equals(targetType);
}
@Override
protected IntermediateEventRepresentation doUpcast(IntermediateEventRepresentation intermediateRepresentation) {
return intermediateRepresentation.upcastPayload(
new SimpleSerializedType(
"event.new.path", "2.0"),
org.dom4j.Document.class,
null
);
}
`
Is this the correct way of writing upcasters and is there another way to deal with this without using upcasters?