Interface CasterChain<I,O>

Type Parameters:
I - the input type
O - the output type
All Superinterfaces:
Caster<I,O>
All Known Implementing Classes:
DefaultCasterChain

public interface CasterChain<I,O> extends Caster<I,O>
A composite Caster that supports registration of multiple casting strategies.

This interface allows dynamic addition of Caster instances, which may be applied in sequence or based on type matching logic. CasterChains are used in serialization and deserialization pipelines to handle transformations like upcasting, downcasting, or schema evolution.

It extends Caster and adds registration capabilities.

  • Method Summary

    Modifier and Type
    Method
    Description
    default <BEFORE, AFTER>
    CasterChain<BEFORE,AFTER>
    intercept(Function<BEFORE,? extends I> before, Function<? super O,AFTER> after)
    Composes this caster chain with input and output interceptors.
    Registers one or more objects that may contain casting logic (e.g. annotated methods or implementations).

    Methods inherited from interface io.fluxcapacitor.javaclient.common.serialization.casting.Caster

    cast, cast
  • Method Details

    • registerCasterCandidates

      Registration registerCasterCandidates(Object... candidates)
      Registers one or more objects that may contain casting logic (e.g. annotated methods or implementations). These candidates are inspected and included into the chain if applicable.
      Parameters:
      candidates - one or more caster providers
      Returns:
      a Registration that can be used to remove the registered casters
    • intercept

      default <BEFORE, AFTER> CasterChain<BEFORE,AFTER> intercept(Function<BEFORE,? extends I> before, Function<? super O,AFTER> after)
      Composes this caster chain with input and output interceptors. Allows pre- and post-processing transformations around the casting logic.
      Specified by:
      intercept in interface Caster<I,O>
      Type Parameters:
      BEFORE - the new input type
      AFTER - the new output type
      Parameters:
      before - a function to convert from BEFORE to I
      after - a function to convert from O to AFTER
      Returns:
      a new CasterChain with adapted input/output types