-
- Type Parameters:
D- deserialized typeS- serialized 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 Serializer<D,S>
Serializes an object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<S>serialize(D deserialized)Serializes the provided object.
-
-
-
Method Detail
-
serialize
Optional<S> serialize(D deserialized)
Serializes the provided object. If the object cannot be properly serialized, 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 serialization fails.
- Parameters:
deserialized- the object to serialize- Returns:
- the serialized result if successful, otherwise empty
-
-