You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Gerhard Petracek (JIRA)" <de...@myfaces.apache.org> on 2011/08/08 01:22:27 UTC

[jira] [Resolved] (EXTCDI-204) evaluate injectable resource bundle

     [ https://issues.apache.org/jira/browse/EXTCDI-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerhard Petracek resolved EXTCDI-204.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0.1

> evaluate injectable resource bundle
> -----------------------------------
>
>                 Key: EXTCDI-204
>                 URL: https://issues.apache.org/jira/browse/EXTCDI-204
>             Project: MyFaces CODI
>          Issue Type: Task
>          Components: Core
>    Affects Versions: 1.0.0
>            Reporter: Gerhard Petracek
>            Assignee: Gerhard Petracek
>             Fix For: 1.0.1
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira