org.axonframework.saga.repository
Class JavaSagaSerializer

java.lang.Object
  extended by org.axonframework.saga.repository.JavaSagaSerializer
All Implemented Interfaces:
SagaSerializer

public class JavaSagaSerializer
extends Object
implements SagaSerializer

SagaSerializer implementation that uses Java serialization to serialize and deserialize Sagas. This implementation is very suitable if the life span of a Saga allows classes to remain unchanged. If Class definitions need to be changed during the life cycle of existing Sagas, another implementation, like the XStreamSagaSerializer might be a more suitable alternative.

Since:
0.7
Author:
Allard Buijze

Constructor Summary
JavaSagaSerializer()
           
 
Method Summary
 Saga deserialize(byte[] serializedSaga)
          Deserializes the given serializedSaga.
 byte[] serialize(Saga saga)
          Serialize the given saga to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaSagaSerializer

public JavaSagaSerializer()
Method Detail

serialize

public byte[] serialize(Saga saga)
Description copied from interface: SagaSerializer
Serialize the given saga to a byte array.

Specified by:
serialize in interface SagaSerializer
Parameters:
saga - The saga to serialize
Returns:
The bytes representing the serialized form of the Saga

deserialize

public Saga deserialize(byte[] serializedSaga)
Description copied from interface: SagaSerializer
Deserializes the given serializedSaga.

Specified by:
deserialize in interface SagaSerializer
Parameters:
serializedSaga - the bytes representing the serialized form of a Saga
Returns:
The Saga instance represented by the given bytes


Copyright © 2011. All Rights Reserved.