Thoughts on Path Translation - microbean/microbean-settings GitHub Wiki
We need a way to translate a Path
. We can, of course, use the configuration system itself for this.
What I mean is, if component A asks for void.class/frobnicator/String.class
and component B asks for void.class/frobnicator/String.class
and there are semantic differences between those requests that cannot be discerned from the path itself, then we need a facility for whoever is going to use these components to tease these requests apart.
We've already got part of this, maybe, though it's a bit low-level. In ProxyingProvider
, there is a BiFunction
that takes a method name and returns a property name for it. So all stuff that goes through the ProxyingProvider
has at least the conceptual possibility of being translated on the fly. We need to generalize this up a level.
Other approaches might include punting this to qualifiers: perhaps there are implicit qualifiers that are added to components' calls to the configuration system? But this wouldn't allow us to translate arguments. I think it has to be at the path level. Or maybe we fold in qualifier translation as well.
But qualifiers are already an application-level concern, so arguably will never need to be translated, whereas a Path
is something that a user supplies explicitly with each configuration request.
I think that a method on ConfiguredSupplier
somewhere that accepts a user-supplied Path
and returns an application-suitable Path
(the same object in most cases) is probably called for.