Class CodecAdapter<T,S>
java.lang.Object
me.a8kj.config.template.experimental.codec.CodecAdapter<T,S>
- Type Parameters:
T- the domain object typeS- the serialized representation type
Provides a unified abstraction for bidirectional data transformation
between domain objects and their serialized representations.
Note: This is an experimental feature and is currently considered unstable.
This adapter composes both a Serializer and a Deserializer
to ensure consistent encoding and decoding logic across the application.
It serves as a central conversion bridge between the domain layer
and external storage or transport layers.
- Since:
- 0.3
- Author:
- a8kj7sea
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CodecAdapter
public CodecAdapter()
-
-
Method Details
-
serialize
Serializes the given domain object into its encoded representation.Delegates the transformation process to the configured
Serializer.- Parameters:
obj- the domain object to serialize- Returns:
- the serialized representation, or
nullif the object isnullor serialization fails
-
deserialize
Deserializes the provided data into a domain object instance.Delegates the reconstruction process to the configured
Deserializer. If the provided data isnullor invalid, the result may benull.- Parameters:
data- the serialized data to deserialize, may benull- Returns:
- the reconstructed domain object, or
nullif deserialization fails or input isnull
-