Class CompositeResolver
- All Implemented Interfaces:
Resolver
Resolver
implementation that handles complex or structured objects
by applying one or more matching Adapter
instances.
The CompositeResolver
delegates the resolution process to registered
adapters that know how to transform an object into a set of string values,
each of which is mapped to a derived MacroKey
. The resolved entries
typically include sub-keys that extend the base key in a dot-notated form.
This resolver does not overwrite existing entries in the base key when used
in conjunction with a FieldResolver
; it merely returns all extracted
key-value pairs. The calling resolver is responsible for deciding merge behavior.
Example flow:
- Retrieve the object from the
MacroObjectMap
using the givenmacroKey
. - Find all matching adapters for the object via the
AdapterRegistry
. - For each adapter, adapt the object and extract key-value mappings via the
FieldExtractor
. - Aggregate all mappings into a
MacroStringMap
.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeResolver
(AdapterRegistry adapterRegistry, FieldExtractor fieldExtractor) Constructs aCompositeResolver
with the given adapter registry and field extractor. -
Method Summary
Modifier and TypeMethodDescriptionresolve
(MacroKey macroKey, MacroObjectMap macroObjectMap) Resolves aMacroKey
by attempting to adapt the associated object from theMacroObjectMap
using applicableAdapter
instances.
-
Constructor Details
-
CompositeResolver
Constructs aCompositeResolver
with the given adapter registry and field extractor.- Parameters:
adapterRegistry
- an instance that manages and matchesAdapter
objectsfieldExtractor
- an instance used to extract field values from adapted objects
-
-
Method Details
-
resolve
Resolves aMacroKey
by attempting to adapt the associated object from theMacroObjectMap
using applicableAdapter
instances.For each adapter that supports the object, this method invokes the adapter’s
adapt
method, then extracts sub-key mappings via theFieldExtractor
.The resulting
MacroStringMap
contains mappings for the derived sub-keys. The base key may also be included if provided by the adapter and extractor.- Specified by:
resolve
in interfaceResolver
- Parameters:
macroKey
- the key used to retrieve the source object from the macro object mapmacroObjectMap
- the object map containing input values to be resolved- Returns:
- a
MacroStringMap
containing resolved sub-key mappings for the adapted object
-