[seam-issues] [JBoss JIRA] (SEAMINTL-70) Document usage of BundleTemplateMessage/TemplateMessage

Ken Finnigan (Updated) (JIRA) jira-events at lists.jboss.org
Tue Dec 20 22:07:09 EST 2011


     [ https://issues.jboss.org/browse/SEAMINTL-70?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ken Finnigan updated SEAMINTL-70:
---------------------------------

    Fix Version/s: 3.2.0.Alpha1
                       (was: 3.1.0.Final)

    
> Document usage of BundleTemplateMessage/TemplateMessage
> -------------------------------------------------------
>
>                 Key: SEAMINTL-70
>                 URL: https://issues.jboss.org/browse/SEAMINTL-70
>             Project: Seam International
>          Issue Type: Feature Request
>          Components: Messages
>    Affects Versions: 3.1.0.Beta3
>            Reporter: Gerald Turner
>            Assignee: Ken Finnigan
>            Priority: Optional
>             Fix For: 3.2.0.Alpha1
>
>
> As a user, the current documentation is sufficient for severity+text messages, however on closer inspection of the Message class, I see that detail and targets properties are available, much like FacesMessage.
> I dug around the seam-international source and experimented with a bean having fields/method like the following:
>   @Inject
>   private Messages messages;
>   @Inject
>   private transient TemplateMessage message;
>   public void doSometing() {
>     messages.add(message.level(Level.WARN).text("Text {0}, {1}, {2}").textParams('a', 'b', 'c').detail("Detail {0}, {1}, {2}").detailParams(1, 2, 3).targets("message").build());
>     messages.add(message.level(Level.FATAL).text("Fatality!").targets("message").build());
>   }
> This works.  A few caveats:
> * TemplateMessage field has to be marked transient, otherwise get WELD error during deployment about Serializable bean having non-Serializable field.
> * Make sure to call add(Message) signature (invoke build()) instead of add(MessageBuilder), otherwise only the most recent message is added.
> * doSomething method is not reentrant/thread-safe because of the builder.
> I'd prefer to use Messages instead of the builders, perhaps have a methods like info(String text, String details, String targets, Object... args), however that gets ugly with the varargs, having to cast Object[], etc.  Perhaps I should stick with FacesMessages.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list