Interface Deserializer<S,​D>

  • Type Parameters:
    S - serialized type
    D - deserialized type
    All Known Subinterfaces:
    Adapter<S,​D>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Deserializer<S,​D>
    Deserializes an object.
    • Method Detail

      • deserialize

        Optional<D> deserialize​(S serialized)
        Deserializes the provided object. If the object cannot be properly deserialized, then the result will be empty.

        Note: this should never throw any runtime exceptions or return null. An empty optional should always be returned if deserialization fails.

        Parameters:
        serialized - the object to deserialize
        Returns:
        the deserialized result if successful, otherwise empty