Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.2-incubating
    • Fix Version/s: 0.3-incubating
    • Component/s: Core
    • Labels:
      None

      Description

      BeanProvider is a very cool way to get bean from not managed objects but it is not so cool to use with @Dependent CDI Beans because it is not cleanable

      return with the bean the creational context can help to do so ("you are not managed so clean it yourself")

      instead of returning the bean a wrapper could be returned like for instance (this class should be enhanced since it manages only one dependent instance):

      public class BeanInstance {
      private Object bean;
      private CreationalContext<?> context;

      public BeanInstance(Object bean, CreationalContext<?> context)

      { this.bean = bean; this.context = context; }

      public boolean isResolved()

      { return bean != null; }

      public Object getBean()

      { return bean; }

      public void release()

      { context.release(); }

      }

        Activity

        Romain Manni-Bucau created issue -
        Romain Manni-Bucau made changes -
        Field Original Value New Value
        Description BeanProvider is a very cool way to get bean from not managed objects but it is not so cool to use with @Dependent CDI Beans because it is not cleanable

        return with the bean the creational context can help to do so ("you are not managed so clean it yourself")

        instead of returning the bean a wrapper could be returned like for instance:

        public class BeanInstance {
            private Object bean;
            private CreationalContext<?> context;

            public BeanInstance(Object bean, CreationalContext<?> context) {
                this.bean = bean;
                this.context = context;
            }

            public boolean isResolved() {
                return bean != null;
            }

            public Object getBean() {
                return bean;
            }

            public void release() {
                context.release();
            }
        }
        BeanProvider is a very cool way to get bean from not managed objects but it is not so cool to use with @Dependent CDI Beans because it is not cleanable

        return with the bean the creational context can help to do so ("you are not managed so clean it yourself")

        instead of returning the bean a wrapper could be returned like for instance (this class should be enhanced since it manages only one dependent instance):

        public class BeanInstance {
            private Object bean;
            private CreationalContext<?> context;

            public BeanInstance(Object bean, CreationalContext<?> context) {
                this.bean = bean;
                this.context = context;
            }

            public boolean isResolved() {
                return bean != null;
            }

            public Object getBean() {
                return bean;
            }

            public void release() {
                context.release();
            }
        }
        Mark Struberg made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Gerhard Petracek [ gpetracek ] Mark Struberg [ struberg ]
        Fix Version/s 0.3-incubating [ 12319478 ]
        Resolution Fixed [ 1 ]
        Gerhard Petracek made changes -
        Component/s Core [ 12317002 ]
        Gerhard Petracek made changes -
        Affects Version/s 0.2-incubating [ 12319477 ]
        Mark Struberg made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mark Struberg
            Reporter:
            Romain Manni-Bucau
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development