Class FieldAccessorRegistry
- All Implemented Interfaces:
AccessorRegistry
Accessor instances available to the macro resolution pipeline.
This registry is responsible for:
- Registering built-in accessors at construction time, in a defined priority order
- Allowing additional plugin-defined accessors to be registered at runtime
- Providing a filtered stream of accessors that support a given object type
Adapters are evaluated in the order they are registered, ensuring predictable precedence when multiple accessors populate the same macro keys. The first adapter to return a value for a given string wins, and later accessors cannot overwrite it.
This allows plugin developers and library consumers to control the resolution order by selectively registering their own accessors before or after the built-in set.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anAccessorRegistryand registers all built-in accessors in preferred priority order. -
Method Summary
-
Constructor Details
-
FieldAccessorRegistry
Constructs anAccessorRegistryand registers all built-in accessors in preferred priority order.- Parameters:
ctx- a context container providing shared utilities to each adapter
-
-
Method Details
-
register
Registers a newAccessorinto 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 accessors are registered in a preferred resolution priority.
- Specified by:
registerin interfaceAccessorRegistry- Parameters:
accessor- the accessor to register- Throws:
NullPointerException- if the accessor isnull
-
getMatchingAdapters
Returns a stream of all registeredAccessorinstances that support the given object.Each adapter is evaluated in order, and only those for which
Accessor.supports(Object)returnstrueare included in the result.- Specified by:
getMatchingAdaptersin interfaceAccessorRegistry- Parameters:
object- the object to test for adapter support- Returns:
- a stream of supporting accessors, or an empty stream if the object is
null
-