Replies: 1 comment 2 replies
-
Here's my thoughts, hopefully this helps. From our discussions thus far, and the initial code dumps, I have come away with the understanding that (like MicroProfile Config), the config source is not concerned with types (generally speaking), and the "raw" value from the source would (somehow) be transformed using a typed converter (e.g. final MyThing<Foo, Bar> myFooBarThing = config.get(configPathOrKey, myFooBarThingConverter); Additionally, MP Config has provided API methods for simple non-generic type conversions which accept a I don't think we want to mess around with complex type token schemes; that's probably biting off too much in one go. Between the ability to use an explicit converter on retrieval, and the object binding layer which can do much more sophisticated things, I've found this approach to be adequate even for complex use cases, at least within the context of Quarkus. |
Beta Was this translation helpful? Give feedback.
-
What is the committee's collective opinion, if there is one, on subtyping during retrieval?
I will deliberately use the stupidest possible names I can think of to illustrate my point so that we don't get hung up on an API.
Again the API below is not important. The typing information is.
Consider:
And now let us say that an implementation of
retrieve
ends up finding aString
(an implementation ofCharSequence
). Should the retrieval succeed? It is a subtype match, not an exact match. (Surely yes?)What about:
…where
GaftersGadget
embodies Gafter's gadget in much the same way asjakarta.enterprise.util.TypeLiteral
.And now let us say that an implementation of
retrieve
ends up finding aSubFrobnicator<Map<String, Integer>>
(a subtype ofFrobnicator<Map<String, Integer>>
if I am typing things right and have my parameterized type assignability rules correct—in any event, you get the idea). Should the retrieval succeed? It is a subtype match, not an exact match.Assuming the
retrieve
operation is backed by multiple sub-providers ("config sources") (which of course is not a given nor required by the API but yet often assumed by the committee as a given), should it be able to distinguish between a provider that finds aFrobnicator<Map<String, String>>
and aFrobnicator<Map<String, Integer>>
and pick the right one? If so, what runtime type assignability semantics is it using? Straight-up Java's? Or will there be restrictions? If so, which ones?In short:
If both of these examples should work, what are the type assignability rules we're going to outline? Are they CDI's, basically?
If neither of these examples should work, how should the retriever user interrogate the system to discover what types of things she can retrieve, given that, by definition, the types of things she wants to retrieve (the types she uses at compile time) will stand the possibility of being different from the types of things that are available at runtime?
Beta Was this translation helpful? Give feedback.
All reactions