[ 
https://issues.apache.org/jira/browse/DELTASPIKE-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14037619#comment-14037619
 ] 

Rafael Benevides commented on DELTASPIKE-228:
---------------------------------------------

I created the following impl:

{code}
@MessageBundle
@Named
public interface SimpleMessage
{

    @MessageTemplate("{welcome_to_deltaspike}")
    String welcomeToDeltaSpike();
    
    @MessageTemplate("{welcome_to}")
    String welcomeTo(String name);
    
    @MessageTemplate("{welcome_to_deltaspike}")
    String getWelcomeMessage();
}
{code}

And I was able to use it in EL through

{code}
EL 1: #{simpleMessage.welcomeToDeltaSpike()}
EL 2: #{simpleMessage.welcomeTo("Rafael")}
EL 3: #{simpleMessage.welcomeMessage}
{code}  

So I think this ticket is outdated, right ?

> Make @MessageBundle annotated type available via EL 
> ----------------------------------------------------
>
>                 Key: DELTASPIKE-228
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-228
>             Project: DeltaSpike
>          Issue Type: New Feature
>          Components: I18n-Module, JSF-Module
>    Affects Versions: 0.2-incubating
>            Reporter: Thomas Herzog
>            Assignee: Rafael Benevides
>             Fix For: 1.0.2
>
>
> After you defined an MessageBundle type, you wanna use it in the views as 
> well without wrapping the type into a @Named annotated cdi bean to be 
> available to use it via EL.
> It would be fine if the implementation would be created and registrered as an 
> cdi bean at deployment time and therefore available via EL in the views.
> I think the main usage for the messages is in the views, at least in our 
> usacases.
> Therefore it would also nice to define the name of the created cdi bean via 
> maybe @MessageContextConfig annotation and default should be the name of the 
> type, but the name of the type could be same, just placed in different 
> packages.
> If this will be done the developer only has to define his MessageBundle type 
> with the getter for the messages and configuration via annotation if 
> necessary, and use it in the views right away.
> Regarding to issue DELTASPIKE-223 it would be necessary to think about 
> follwing possible issues.
> If there would be multiple choices for the convention of the getter methods 
> for the messages defined in the MessageBundle type, there could occur 
> follwing problems.
> 1. String welcomeTo(); // Key: welcome_to
> 2. String getWelcomeTo();  // Key: welcome_to with get prefix
> 3  String getWelcomeTo();  // Key: get_welcome_to
> @1
> How will EL resolve the method if called via #{type.welcomeTo} ?
> As far as i know EL would try to invoke getWelcomeTo() method which could not 
> be found in this case !!
> @2 and 3
> How will it be distiguished if get prefix is part of the key or just the 
> start of the getter method? 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to