Class AdapterRegistry
Adapter
instances available to the macro resolution pipeline.
This registry is responsible for:
- Registering built-in adapters at construction time, in a defined priority order
- Allowing additional plugin-defined adapters to be registered at runtime
- Providing a filtered stream of adapters that support a given object type
Adapters are evaluated in the order they are registered, ensuring predictable precedence when multiple adapters populate the same macro keys. The first adapter to return a value for a given key wins, and later adapters cannot overwrite it.
This allows plugin developers and library consumers to control the resolution order by selectively registering their own adapters before or after the built-in set.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAdapterRegistry
and registers all built-in adapters in preferred priority order. -
Method Summary
-
Constructor Details
-
AdapterRegistry
Constructs anAdapterRegistry
and registers all built-in adapters in preferred priority order.- Parameters:
ctx
- a context container providing shared utilities to each adapter
-
-
Method Details
-
register
Registers a newAdapter
into the registry.Adapters are added to the end of the internal list and evaluated in the order they were registered. It is the caller's responsibility to ensure adapters are registered in a preferred resolution priority.
- Parameters:
adapter
- the adapter to register- Throws:
NullPointerException
- if the adapter isnull
-
getMatchingAdapters
Returns a stream of all registeredAdapter
instances that support the given object.Each adapter is evaluated in order, and only those for which
Adapter.supports(Object)
returnstrue
are included in the result.- Parameters:
object
- the object to test for adapter support- Returns:
- a stream of supporting adapters, or an empty stream if the object is
null
-