Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      e.g.:

      @Bundle //without #name it will be mapped by convention
      public interface MyConfig
      {
      @Named("value1")
      public class MyValue1 implements BundleKey, MyConfig {}

      public class MyValue2 implements BundleKey, MyConfig {}
      }

      usage:

      @Inject
      @Bundle(MyConfig.class)
      private ResourceBundle resourceBundle;
      //...
      this.resourceBundle.getValue(MyConfig.MyValue2.class);

      @Produces
      @MyConfig
      protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createConfig(org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle)

      { return injectableResourceBundle.useBundle("my.custom.bundle"); }

      or

      @Produces
      @MyLabels
      protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createLabels(@Jsf org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) { return injectableResourceBundle.useBundle("my.custom.bundle"); }

      ... to benefit from the existing local-resolver.

      usage:

      @Inject
      @MyLabels
      private ResourceBundle injectableResourceBundle;

      this.injectableResourceBundle.getValue("myKey");

      it would allow to inject resource-bundles in a type-safe manner and it should be a simple wrapper for java.util.ResourceBundle but without MissingResourceException.

        Activity

        Gerhard Petracek created issue -
        Gerhard Petracek made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Gerhard Petracek made changes -
        Description e.g.:

        @Produces
        @MyConfig
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createConfig(org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.baseName("my.custom.bundle");
        }

        or

        @Produces
        @MyLabels
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createLabels(@Jsf org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.baseName("my.custom.bundle");
        }

        ... to benefit from the existing local-resolver.

        usage:

        @Inject
        @MyLabels
        private ResourceBundle injectableResourceBundle;

        this.injectableResourceBundle.getString("myKey");

        it would allow to inject resource-bundles in a type-safe manner and it should be a simple wrapper for java.util.ResourceBundle but without MissingResourceException.
        e.g.:


        @Bundle //without #name it will be mapped by convention
        public interface MyConfig
        {
            @Named("value1")
            public class MyValue1 implements BundleKey, MyConfig {}

            public class MyValue2 implements BundleKey, MyConfig {}
        }

        usage:

        @Inject
        @Bundle(MyConfig.class)
        private ResourceBundle resourceBundle;
        //...
        this.resourceBundle.getValue(MyConfig.MyValue2.class);


        @Produces
        @MyConfig
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createConfig(@Bundle org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        or

        @Produces
        @MyLabels
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createLabels(@Jsf org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        ... to benefit from the existing local-resolver.

        usage:

        @Inject
        @MyLabels
        private ResourceBundle injectableResourceBundle;

        this.injectableResourceBundle.getValue("myKey");

        it would allow to inject resource-bundles in a type-safe manner and it should be a simple wrapper for java.util.ResourceBundle but without MissingResourceException.
        Gerhard Petracek made changes -
        Description e.g.:


        @Bundle //without #name it will be mapped by convention
        public interface MyConfig
        {
            @Named("value1")
            public class MyValue1 implements BundleKey, MyConfig {}

            public class MyValue2 implements BundleKey, MyConfig {}
        }

        usage:

        @Inject
        @Bundle(MyConfig.class)
        private ResourceBundle resourceBundle;
        //...
        this.resourceBundle.getValue(MyConfig.MyValue2.class);


        @Produces
        @MyConfig
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createConfig(@Bundle org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        or

        @Produces
        @MyLabels
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createLabels(@Jsf org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        ... to benefit from the existing local-resolver.

        usage:

        @Inject
        @MyLabels
        private ResourceBundle injectableResourceBundle;

        this.injectableResourceBundle.getValue("myKey");

        it would allow to inject resource-bundles in a type-safe manner and it should be a simple wrapper for java.util.ResourceBundle but without MissingResourceException.
        e.g.:


        @Bundle //without #name it will be mapped by convention
        public interface MyConfig
        {
            @Named("value1")
            public class MyValue1 implements BundleKey, MyConfig {}

            public class MyValue2 implements BundleKey, MyConfig {}
        }

        usage:

        @Inject
        @Bundle(MyConfig.class)
        private ResourceBundle resourceBundle;
        //...
        this.resourceBundle.getValue(MyConfig.MyValue2.class);


        @Produces
        @MyConfig
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createConfig(org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        or

        @Produces
        @MyLabels
        protected org.apache.myfaces.extensions.cdi.core.api.ResourceBundle createLabels(@Jsf org.apache.myfaces.extensions.cdi.core.api.ResourceBundle injectableResourceBundle) {
          return injectableResourceBundle.useBundle("my.custom.bundle");
        }

        ... to benefit from the existing local-resolver.

        usage:

        @Inject
        @MyLabels
        private ResourceBundle injectableResourceBundle;

        this.injectableResourceBundle.getValue("myKey");

        it would allow to inject resource-bundles in a type-safe manner and it should be a simple wrapper for java.util.ResourceBundle but without MissingResourceException.
        Gerhard Petracek made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 1.0.1 [ 12316527 ]
        Resolution Fixed [ 1 ]
        Gerhard Petracek made changes -
        Summary evaluate injectable resource bundle injectable resource bundle
        Issue Type Task [ 3 ] New Feature [ 2 ]
        Gerhard Petracek made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Gerhard Petracek
            Reporter:
            Gerhard Petracek
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development