0
I am working on the internationalization of my messages and their centralization. I have the following methods:
private static void addMessage(Severity severity, String mensagem, Object...args){
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage facesMessage = new FacesMessage(severity, String.format(get(mensagem, args)), "");
context.addMessage(null, facesMessage);
}
public static void addInfoMessage(String chave, Object...args){
addMessage(FacesMessage.SEVERITY_INFO, chave, args);
}
public static void addInfoMessage(String chave){
addMessage(FacesMessage.SEVERITY_INFO, chave, new Object[]{null});
}
To try to repurpose code I’m trying to pass as null
my object array. However in the method addMessage
is coming an object referring to my class that calls the addInfoMessage
. Does anyone know why and how I solve?
If you put a
new Exception("Teste").printStackTrace();
in his methodaddMessage
, what appears?– Victor Stafusa
Using cast making addMessage(Facesmessage.SEVERITY_INFO, key, (Object[]) null);
– Erick Maia