Uploaded image for project: 'MyFaces CODI'
  1. MyFaces CODI
  2. EXTCDI-204

injectable resource bundle

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.0
    • 1.0.1
    • Core
    • 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.

      Attachments

        Activity

          People

            gpetracek Gerhard Petracek
            gpetracek Gerhard Petracek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: