I'm facing a design pattern situation and I wanna here your ideas.
I have a class to manage Internalization.
public class Internalization {
@Autowired
LocaleService localeService;
public String getMessage(String codeError) {
return localeService.getMessage(codeError);
}
And I wanna to be able to use the getMessage method in all classes without having to instanciate the Internalisation class.
I'am aware that in this case I'am not able to use static methods, the only solution is to use extends
public class A extends Internalization{
public void doThis(String message){
getMessage("Yes!")
}
}
I'm intrested to here your opinions
Aucun commentaire:
Enregistrer un commentaire