org.axonframework.quickstart
Class RunUpcaster.ToDoItemUpcaster

java.lang.Object
  extended by org.axonframework.upcasting.AbstractSingleEntryUpcaster<org.dom4j.Document>
      extended by org.axonframework.quickstart.RunUpcaster.ToDoItemUpcaster
All Implemented Interfaces:
Upcaster<org.dom4j.Document>
Enclosing class:
RunUpcaster

public static class RunUpcaster.ToDoItemUpcaster
extends AbstractSingleEntryUpcaster<org.dom4j.Document>

This is our upcaster. It converts the XML representation of a ToItemCreatedEvent to a NewToDoItemWithDeadlineCreatedEvent. The latter contains an explicit deadline of the task at hand.


Constructor Summary
RunUpcaster.ToDoItemUpcaster()
           
 
Method Summary
 boolean canUpcast(SerializedType serializedType)
          Indicates whether this upcaster is capable of upcasting the given type.
 org.dom4j.Document doUpcast(SerializedObject<org.dom4j.Document> intermediateRepresentation, UpcastingContext context)
          Upcasts the given intermediateRepresentation into zero or more other representations.
 SerializedType doUpcast(SerializedType serializedType)
          Upcast the given serializedType into its new format.
 Class<org.dom4j.Document> expectedRepresentationType()
          Returns the type of intermediate representation this upcaster expects.
 
Methods inherited from class org.axonframework.upcasting.AbstractSingleEntryUpcaster
upcast, upcast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunUpcaster.ToDoItemUpcaster

public RunUpcaster.ToDoItemUpcaster()
Method Detail

canUpcast

public boolean canUpcast(SerializedType serializedType)
Description copied from interface: Upcaster
Indicates whether this upcaster is capable of upcasting the given type. Unless this method returns true, the Upcaster.upcast(org.axonframework.serializer.SerializedType) and Upcaster.upcast(org.axonframework.serializer.SerializedType) methods should not be invoked on this Upcaster instance.

Parameters:
serializedType - The type under investigation
Returns:
true if this upcaster can upcast the given serialized type, false otherwise.

expectedRepresentationType

public Class<org.dom4j.Document> expectedRepresentationType()
Description copied from interface: Upcaster
Returns the type of intermediate representation this upcaster expects. The serializer must ensure the intermediate representation is offered in a compatible format.

Returns:
the type of intermediate representation expected

doUpcast

public org.dom4j.Document doUpcast(SerializedObject<org.dom4j.Document> intermediateRepresentation,
                                   UpcastingContext context)
Description copied from class: AbstractSingleEntryUpcaster
Upcasts the given intermediateRepresentation into zero or more other representations. The returned list of Serialized Objects must match the given list of serialized types.

This method may return null to indicate a deprecated object.

Specified by:
doUpcast in class AbstractSingleEntryUpcaster<org.dom4j.Document>
Parameters:
intermediateRepresentation - The representation of the object to upcast
context - An instance describing the context of the object to upcast
Returns:
the new representation of the object

doUpcast

public SerializedType doUpcast(SerializedType serializedType)
Description copied from class: AbstractSingleEntryUpcaster
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).

If null is returned, the Serialized object of this type is considered deprecated and will not be subject to upcasting.

Specified by:
doUpcast in class AbstractSingleEntryUpcaster<org.dom4j.Document>
Parameters:
serializedType - The serialized type to upcast
Returns:
the upcast serialized type


Copyright © 2010-2016. All Rights Reserved.