Class UnknownSerializedType

java.lang.Object
org.axonframework.serialization.UnknownSerializedType

public class UnknownSerializedType extends Object
Class representing a serialized object of which there is no class available in the current class loader. This class provides access to the raw underlying data, as well as any format supported by the serializer.
Since:
4.0
Author:
Allard Buijze
  • Constructor Details

    • UnknownSerializedType

      public UnknownSerializedType(Serializer serializer, SerializedObject<?> serializedObject)
      Initialize the unknown type, using given serializer and serializedObject.
      Parameters:
      serializer - the serializer attempting to deserialize the object
      serializedObject - the object being deserialized
  • Method Details

    • supportsFormat

      public <T> boolean supportsFormat(Class<T> desiredFormat)
      Indicates whether the given desiredFormat is supported as a representation for this type. More specifically, it will consult the serializer that returned this instance whether it has a converter to convert the serialized object's data to the desired type
      Type Parameters:
      T - the format in which the serialized object is desired
      Parameters:
      desiredFormat - the format in which the serialized object is desired
      Returns:
      true if the format is supported, otherwise false
    • readData

      public <T> T readData(Class<T> desiredFormat)
      Returns the data contained in the serialized object in the given desiredFormat, if supported. If the desired format is unsupported, an exception is thrown, depending on the serializer.

      To verify whether a format is supported, use supportsFormat(Class).

      Type Parameters:
      T - the format in which the data is desired
      Parameters:
      desiredFormat - the format in which the data is desired
      Returns:
      the data in the desired format
    • serializedType

      public SerializedType serializedType()
      Returns the type of the serialized object, for which no class could be resolved.
      Returns:
      the type of the serialized object