Hi. I need to implement a custom scope and its related context. I was thinking of having a Map<Contextual<?>, BeanInstance<?>>
where BeanInstance<> is a thin wrapper around the pair: instance (the concrete bean instance) and CreationalContext (to be able to easily destroy the bean when destroying the context).
My question is regarding the map key - what do you suggest would make a good key? It doesn't have to be contextual, it only has to make it possible to get the right BeanInstance for a given Contextual, or null in which case I will (possibly) create a new one.
I would like the code not to be Weld dependent, so general advice would be appreciated.