org.axonframework.serializer
Class LazyDeserializingObject<T>

java.lang.Object
  extended by org.axonframework.serializer.LazyDeserializingObject<T>
Type Parameters:
T - The type of object contained in the serialized object

public class LazyDeserializingObject<T>
extends Object

Represents a serialized object that can be deserializedObjects upon request. Typically used as a wrapper class for keeping a SerializedObject and its Serializer together.

Since:
2.0
Author:
Allard Buijze, Frank Versnel

Constructor Summary
LazyDeserializingObject(SerializedObject<?> serializedObject, Serializer serializer)
           
LazyDeserializingObject(T deserializedObject)
          Creates an instance with the given deserializedObject object instance.
 
Method Summary
 T getObject()
          De-serializes the object and returns the result.
 SerializedObject<?> getSerializedObject()
          Returns the serialized object to deserialize upon request
 Serializer getSerializer()
          Returns the serializer to deserialize this object
 Class<?> getType()
          Returns the class of the serialized object.
 boolean isDeserialized()
          Indicates whether this object has already been deserialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyDeserializingObject

public LazyDeserializingObject(T deserializedObject)
Creates an instance with the given deserializedObject object instance. Using this constructor will ensure that no deserializing is required when invoking the getType() or getObject() methods.

Parameters:
deserializedObject - The deserialized object to return on getObject()

LazyDeserializingObject

public LazyDeserializingObject(SerializedObject<?> serializedObject,
                               Serializer serializer)
Parameters:
serializedObject - The serialized payload of the message
serializer - The serializer to deserialize the payload data with
Throws:
UnknownSerializedTypeException - if the type of the serialized object cannot be resolved to a class
Method Detail

getType

public Class<?> getType()
Returns the class of the serialized object.

Returns:
the class of the serialized object

getObject

public T getObject()
De-serializes the object and returns the result.

Returns:
the deserialized objects

isDeserialized

public boolean isDeserialized()
Indicates whether this object has already been deserialized. When this method returns true, the getObject() method is able to return a value without invoking the serializer.

Returns:
whether the contained object has been deserialized already.

getSerializer

public Serializer getSerializer()
Returns the serializer to deserialize this object

Returns:
the serializer to deserialize this object

getSerializedObject

public SerializedObject<?> getSerializedObject()
Returns the serialized object to deserialize upon request

Returns:
the serialized object to deserialize upon request


Copyright © 2010-2016. All Rights Reserved.