Enum Class UnknownTypeStrategy

java.lang.Object
java.lang.Enum<UnknownTypeStrategy>
io.fluxzero.sdk.common.serialization.UnknownTypeStrategy
All Implemented Interfaces:
Serializable, Comparable<UnknownTypeStrategy>, Constable

public enum UnknownTypeStrategy extends Enum<UnknownTypeStrategy>
Defines the strategy for handling unknown or unresolvable types during deserialization.

This is used by Serializer implementations to determine how to proceed when a type identifier is not recognized (e.g., missing class, renamed type).

  • AS_INTERMEDIATE – Treat unknown types as intermediate representations. Deserialization may still proceed later based on structural conversion or inspection.
  • IGNORE – Silently skip unknown types. The deserialized stream will exclude them. Default for deserialization of tracked messages.
  • FAIL – Immediately throw a DeserializationException upon encountering an unknown type. Default for event-sourcing.
See Also:
  • Enum Constant Details

    • AS_INTERMEDIATE

      public static final UnknownTypeStrategy AS_INTERMEDIATE
      Represents the strategy to treat unknown or unresolvable types as intermediate representations during the deserialization process. This approach allows for deserialization to potentially proceed later based on structural conversion or further inspection, instead of immediately failing or skipping the unknown type.
    • IGNORE

      public static final UnknownTypeStrategy IGNORE
      Silently skips unknown or unresolvable types during the deserialization process. When this strategy is applied, any type identifier that cannot be resolved will be ignored, and the deserialized output will omit the corresponding data without throwing an error.

      This can be useful when dealing with dynamic schemas or when backward compatibility with modified or incomplete data streams is needed.

      This is the default strategy for deserializing messages from a global message log.

    • FAIL

      public static final UnknownTypeStrategy FAIL
      Defines a strategy where deserialization will immediately fail by throwing a DeserializationException when an unknown or unresolvable type is encountered.

      This strategy ensures strict validation of incoming data, preventing deserialization from proceeding with unrecognized or unsupported type identifiers.

      Typically used in scenarios requiring high reliability and accuracy in the deserialization process.

      This is the default strategy for deserializing events during event sourcing.

  • Method Details

    • values

      public static UnknownTypeStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static UnknownTypeStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null