Class DefaultCasterChain.ConvertingSerializedObject<I,O>
java.lang.Object
io.fluxzero.sdk.common.serialization.casting.DefaultCasterChain.ConvertingSerializedObject<I,O>
- Type Parameters:
I- the input data type before conversionO- the output data type after conversion
- All Implemented Interfaces:
HasSource<io.fluxzero.common.api.SerializedObject<I>>
- Enclosing class:
DefaultCasterChain<T, S extends io.fluxzero.common.api.SerializedObject<T>>
protected static class DefaultCasterChain.ConvertingSerializedObject<I,O>
extends Object
implements HasSource<io.fluxzero.common.api.SerializedObject<I>>
A
SerializedObject wrapper that applies a Converter to translate data from one format to another.
This class enables the DefaultCasterChain to perform casting across multiple intermediate formats,
often used when bridging serialization formats (e.g., JSON → binary, or type-safe objects → byte arrays).
When the actual converted Data is requested, the wrapped converter will be applied lazily and memoized.
The result can be accessed via data() or extracted using getResult().
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConvertingSerializedObject(io.fluxzero.common.api.SerializedObject<I> source, io.fluxzero.common.serialization.Converter<I, O> converter) Constructs aConvertingSerializedObjectwith deferred conversion. -
Method Summary
Modifier and TypeMethodDescriptionio.fluxzero.common.api.Data<O> data()io.fluxzero.common.api.SerializedObject<?> Returns the finalSerializedObjectafter conversion.intgetType()io.fluxzero.common.api.SerializedObject<O> withMetadata(io.fluxzero.common.api.Metadata metadata) Returns a copy of this wrapper whose source carries the given metadata.
-
Constructor Details
-
ConvertingSerializedObject
-
-
Method Details
-
data
-
getType
-
getRevision
public int getRevision() -
withMetadata
public DefaultCasterChain.ConvertingSerializedObject<I,O> withMetadata(io.fluxzero.common.api.Metadata metadata) Returns a copy of this wrapper whose source carries the given metadata.- Parameters:
metadata- the replacement metadata- Returns:
- a wrapper around the updated source
-
getResult
public io.fluxzero.common.api.SerializedObject<?> getResult()Returns the finalSerializedObjectafter conversion.If no transformation occurred (i.e., the result equals the source), the source object is returned directly.
- Returns:
- a converted or original serialized object
-
withData
-