My I18N file:

system.title=Test
welcome.user=Welcome %s
number.of.sessions=15
Atenciosamente,

Juliano Marques
Desenvolvimento Imobiliário
Criciúma - SC
Fone: (48) 3461-1000 





De:     Juliano Marques <[email protected]>
Para:   [email protected], 
Data:   27/06/2014 17:24
Assunto:        Deltaspike Core - MessageBundle



Hi, 

I'm trying to do this: 

@MessageBundle 
public interface I18N { 

    @MessageTemplate("{system.title}") 
    String systemTitle(); 

    @MessageTemplate("{welcome.user}") 
    String welcomeUser(String user); 

    @MessageTemplate("{number.of.sessions}") 
    Integer numberOfSessions(); // this does not work. 
} 

When I deploy my application, I get the following error: 
java.lang.IllegalArgumentException: The following MessageBundle problems 
where found: [int isn't supported. Details: 
br.com.dominiosistemas.messages.I18N#numberOfSessions only 
java.lang.String or org.apache.deltaspike.core.api.message.Message] 
        at 
org.apache.deltaspike.core.impl.message.MessageBundleExtension.installMessageBundleProducerBeans(MessageBundleExtension.java:204)
 

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 

        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 

        at java.lang.reflect.Method.invoke(Method.java:606) 
        at 
org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93)
 

        at 
org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266) 

        at 
org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:125)
 

        at 
org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253) 

        at 
org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232) 

        at 
org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169) 

        at 
org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:128)
 

        at 
org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:102) 

        at 
org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:63)
 

        at 
org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:35)
 

        at 
org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:55)
 

        at 
org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:372) 
        at 
org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:79) 
        at 
org.jboss.as.weld.WeldStartService.start(WeldStartService.java:92) 
        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
 

        at 
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
 

        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 

        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 

        at java.lang.Thread.run(Thread.java:745) 
"}} 

So, MessageBundle does not support @MessageTemplates with another type 
than String or Message. 
My question is: why? 
This is not adressed by documentation or Javadoc in @MessageBundle or 
@MessageTemplate. 

Thanks for the help. Apache Deltaspike is great. 
Atenciosamente,

Juliano Marques
Desenvolvimento Imobiliário
Criciúma - SC
Fone: (48) 3461-1000 


Reply via email to