Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1914

Weld API - add a way to detect proxies and subclasses

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 3.0.1.Final
    • None
    • Proxies, Weld SPI
    • None

      Most likely add a marker interface for proxies/subclasses to the Weld API.

            [WELD-1914] Weld API - add a way to detect proxies and subclasses

            Though about this as well, but is there a real use case for this?

            For a client proxy you might want to unwrap the current contextual instance . So maybe we should define two interfaces, something like WeldClientProxy extends WeldConstruct?

            Hmm, as means to obtain metadata? Isn't it easier to just use BeanManager.getBeans() ?

            For this you would need a correct bean type which is not always that easy to obtain.

            Martin Kouba added a comment - Though about this as well, but is there a real use case for this? For a client proxy you might want to unwrap the current contextual instance . So maybe we should define two interfaces, something like WeldClientProxy extends WeldConstruct ? Hmm, as means to obtain metadata? Isn't it easier to just use BeanManager.getBeans() ? For this you would need a correct bean type which is not always that easy to obtain.

            add possibility to distinguish client proxies (contextual reference) and intercepted subclasses (contextual instances)

            Though about this as well, but is there a real use case for this?

            allow to obtain javax.enterprise.inject.spi.Bean<T> for client proxies

            Hmm, as means to obtain metadata? Isn't it easier to just use BeanManager.getBeans() ?

            Matěj Novotný added a comment - add possibility to distinguish client proxies (contextual reference) and intercepted subclasses (contextual instances) Though about this as well, but is there a real use case for this? allow to obtain javax.enterprise.inject.spi.Bean<T> for client proxies Hmm, as means to obtain metadata? Isn't it easier to just use BeanManager.getBeans() ?

            Martin Kouba added a comment - - edited

            Two more "features" come to my mind:

            • add possibility to distinguish client proxies (contextual reference) and intercepted subclasses (contextual instances)
            • allow to obtain javax.enterprise.inject.spi.Bean<T> for client proxies

            Martin Kouba added a comment - - edited Two more "features" come to my mind: add possibility to distinguish client proxies (contextual reference) and intercepted subclasses (contextual instances) allow to obtain javax.enterprise.inject.spi.Bean<T> for client proxies

            Ok, any particular thoughts on how to do that?
            I was thinking of adding an empty (marker) interface to API which all our proxies would implement. Therefore anyone having a dependency on API could do a simple check such as
            object instanceof WeldProxyMarkerInterface.

            Furthermore, we could also provide a simple interface with boolean method for this check.

            Matěj Novotný added a comment - Ok, any particular thoughts on how to do that? I was thinking of adding an empty (marker) interface to API which all our proxies would implement. Therefore anyone having a dependency on API could do a simple check such as object instanceof WeldProxyMarkerInterface . Furthermore, we could also provide a simple interface with boolean method for this check.

            manovotn I think we should address this in the next Weld 3 API version, i.e. 3.0.SP1.

            Martin Kouba added a comment - manovotn I think we should address this in the next Weld 3 API version, i.e. 3.0.SP1.

            Since 2.3.0.Beta1 and 3.0.0.Alpha11 classes generated by Weld are marked with the SYNTHETIC modifier.

            Jozef Hartinger added a comment - Since 2.3.0.Beta1 and 3.0.0.Alpha11 classes generated by Weld are marked with the SYNTHETIC modifier.

            Jozef Hartinger added a comment - Related https://forum.hibernate.org/viewtopic.php?f=26&t=1039523

              manovotn Matěj Novotný
              mkouba@redhat.com Martin Kouba
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: