Class CompositeResolver
- All Implemented Interfaces:
ValueResolver
ValueResolver implementation that handles complex or structured objects
by applying one or more matching Accessor 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 ValidMacroKey. The resolved entries
typically include sub-keys that extend the base string in a dot-notated form.
This resolver does not overwrite existing entries in the base string when used
in conjunction with a MacroValueResolver; it merely returns all extracted
string-value pairs. The calling resolver is responsible for deciding merge behavior.
Example flow:
- Retrieve the object from the
MacroObjectMapusing the givenmacroKey. - Find all matching adapters for the object via the
FieldAccessorRegistry. - For each adapter, adapt the object and extract string-value mappings via the
MacroFieldAccessor. - Aggregate all mappings into a
MacroStringMap.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeResolver(AccessorRegistry accessorRegistry, MacroFieldAccessor macroFieldAccessor) Constructs aCompositeResolverwith the given adapter registry and field extractor. -
Method Summary
Modifier and TypeMethodDescriptionresolve(ValidMacroKey macroKey, MacroObjectMap macroObjectMap) Resolves aValidMacroKeyby attempting to adapt the associated object from theMacroObjectMapusing applicableAccessorinstances.
-
Constructor Details
-
CompositeResolver
Constructs aCompositeResolverwith the given adapter registry and field extractor.- Parameters:
accessorRegistry- an instance that manages and matchesAccessorobjectsmacroFieldAccessor- an instance used to extract field values from adapted objects
-
-
Method Details
-
resolve
Resolves aValidMacroKeyby attempting to adapt the associated object from theMacroObjectMapusing applicableAccessorinstances.For each adapter that supports the object, this method invokes the adapter’s
adaptmethod, then extracts sub-string mappings via theMacroFieldAccessor.The resulting
MacroStringMapcontains mappings for the derived sub-keys. The base string may also be included if provided by the adapter and extractor.- Specified by:
resolvein interfaceValueResolver- Parameters:
macroKey- the string used to retrieve the source object from the macro object mapmacroObjectMap- the object map containing input values to be resolved- Returns:
- a
MacroStringMapcontaining resolved sub-string mappings for the adapted object
-