Class DefaultCasterChain.ConvertingSerializedObject<I,O>
java.lang.Object
io.fluxcapacitor.javaclient.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:
SerializedObject<O>
,HasSource<SerializedObject<I>>
- Enclosing class:
DefaultCasterChain<T,
S extends SerializedObject<T>>
protected static class DefaultCasterChain.ConvertingSerializedObject<I,O>
extends Object
implements SerializedObject<O>, HasSource<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
(SerializedObject<I> source, Converter<I, O> converter) Constructs aConvertingSerializedObject
with deferred conversion. -
Method Summary
Modifier and TypeMethodDescriptiondata()
Returns the serialized payload held by this object.Returns the finalSerializedObject
after conversion.int
Returns the revision of the serialized object.getType()
Returns the type identifier for the serialized payload.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.common.serialization.casting.HasSource
getSource
Methods inherited from interface io.fluxcapacitor.common.api.SerializedObject
withData
-
Constructor Details
-
ConvertingSerializedObject
Constructs aConvertingSerializedObject
with deferred conversion.- Parameters:
source
- the original serialized objectconverter
- the converter to apply
-
-
Method Details
-
data
Description copied from interface:SerializedObject
Returns the serialized payload held by this object.- Specified by:
data
in interfaceSerializedObject<I>
- Returns:
- the serialized payload
-
getType
Description copied from interface:SerializedObject
Returns the type identifier for the serialized payload.- Specified by:
getType
in interfaceSerializedObject<I>
-
getRevision
public int getRevision()Description copied from interface:SerializedObject
Returns the revision of the serialized object.- Specified by:
getRevision
in interfaceSerializedObject<I>
-
getResult
Returns the finalSerializedObject
after 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
-