Programmatic lookup improvements
See original GitHub issueBoth the reference implementation (Weld) and ArC have an enhanced version of javax.enterprise.inject.Instance
that provide features that might be worth adding to the spec.
Enhancement | Description |
---|---|
Instance#getHandler() (name TBC) |
Allows the client to obtain a “contextual reference handler” which not only holds the contextual reference but also makes it possible to inspect the metadata (i.e. Bean<?> ) of the relevant bean and to destroy the underlying contextual instance. |
Instance#handlers() (name TBC) |
Returns an Iterable of handlers described above. |
select() method that accepts java.lang.reflect.Type |
This allows for generic selection of instances which can be handy while dealing with third party beans through extensions. However, it’s not type-safe. |
Caching the result of Instance#get() |
See https://quarkus.io/guides/cdi-reference#caching-the-result-of-programmatic-lookup |
See also Weld docs about WeldInstance
- Enhanced version of jakarta.enterprise.inject.Instance.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Programmatic lookup improvements
Programmatic lookup improvements ... It is less known that Instance extends Iterable and so it allows to iterate through contextual references of ...
Read more >Programmatic lookup of all beans of parametrized interface
I need to use programmatic lookup to find bean that implement the given interface regardless of parameter types. Because of type safe ...
Read more >The Path to Improve the Programmatic Experience
The programmatic ad buying experience needs to be improved to be more approachable to mid-market advertisers testing it for the first time.
Read more >Programmatic Measure Benchmarks & Performance ...
Provider Portal changesWe've made visual and functional upgrades for an improved experience. For Communities · Healthy Communities.
Read more >The Beginner's Guide to Programmatic Advertising
With programmatic advertising, marketers have more time for the optimization and improvement of ads to drive campaign success.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FTR this issue was discussed during CDI meeting yesterday. General consensus was that the
Handler
feature should be added into specification (e.g.Instance#handlers()
andInstance.getHandler()
) while the remaining two features got mixed reactions and the decision was to be keep track of them but don’t add them to the specification just yet.I wouldn’t call it “just a convenience”, because if you
getHandles()
and filter based onBean
metadata and then want to create an instance, going back to theInstance
would require you to 1. remember position, 2. iterate again and rely on iteration order, which is clunky and generally a bad idea. So I’d consider instantiating and destroying essential.In any case, I just wanted to clarify for myself, and thought perhaps that would be useful for someone else too 😃