Interface CasterChain<I,O>
- Type Parameters:
I- the input typeO- the output type
- All Superinterfaces:
Caster<I,O>
- All Known Implementing Classes:
DefaultCasterChain
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 TypeMethodDescriptiondefault <BEFORE,AFTER>
CasterChain<BEFORE, AFTER> Composes this caster chain with input and output interceptors.registerCasterCandidates(Object... candidates) Registers one or more objects that may contain casting logic (e.g. annotated methods or implementations).
-
Method Details
-
registerCasterCandidates
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
Registrationthat 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.
-