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 conversion
O - 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:
  • Converter
  • SerializedObject
  • Constructor Details

    • ConvertingSerializedObject

      public ConvertingSerializedObject(io.fluxzero.common.api.SerializedObject<I> source, io.fluxzero.common.serialization.Converter<I,O> converter)
      Constructs a ConvertingSerializedObject with deferred conversion.
      Parameters:
      source - the original serialized object
      converter - the converter to apply
  • Method Details

    • data

      public io.fluxzero.common.api.Data<O> data()
    • getType

      public String getType()
    • getRevision

      public int getRevision()
    • getResult

      public io.fluxzero.common.api.SerializedObject<?> getResult()
      Returns the final SerializedObject 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
    • withData

      io.fluxzero.common.api.SerializedObject<O> withData(io.fluxzero.common.api.Data<O> arg0)