Class SplibThymeleafMessageUtil

java.lang.Object
jp.ecuacion.splib.web.util.SplibThymeleafMessageUtil

@Component("msgUtil") public class SplibThymeleafMessageUtil extends Object
Provides localized messages called from thymeleaf.

This calls PropertyFileUtil. The existence of the class doesn't prevent you to use #{...}.

  • Constructor Details

    • SplibThymeleafMessageUtil

      public SplibThymeleafMessageUtil()
      Constructs a new instance.
  • Method Details

    • hasKey

      public boolean hasKey(String key)
      Returns whether properties files have a message with key.
      Parameters:
      key - key
      Returns:
      boolean
    • getValue

      public String getValue(Locale locale, String key, String... args)
      Gets message or itemName from the specified key.
      Parameters:
      locale - locale
      key - key
      Returns:
      String
    • getValueOrElse

      public String getValueOrElse(Locale locale, String key, String defaultValue, String... args)
      Returns value from the argument key.
      Parameters:
      key - key
      Returns:
      String