Class SplibThymeleafPropertiesUtil

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

@Component("propUtil") public class SplibThymeleafPropertiesUtil extends Object
Offers access to application[...].properties. It's supposed to called from thymeleaf.

It calls PropertyFileUtil inside.

  • Constructor Details

    • SplibThymeleafPropertiesUtil

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

    • hasKey

      public boolean hasKey(String key)
      Returns a boolean whether application[...].properties has the argument key.
      Parameters:
      key - key
      Returns:
      boolean
    • getValue

      public String getValue(String key)
      Returns value from the argument key.
      Parameters:
      key - key
      Returns:
      String
    • getValueOrElse

      public String getValueOrElse(String key, String defaultValue)
      Returns value from the argument key or defaultValue when the key does not exist in application[...].properties.
      Parameters:
      key - key
      Returns:
      value
    • getLoginStateDependentValueOrElse

      public String getLoginStateDependentValueOrElse(String loginState, String key, String defaultValue)
      Returns loginState dependent value.

      When you set 'test.key1' to "key" argument, it recognize 'test.key1' as a default key, 'test.key1-account' for account loginState and 'test.key1-admin' for admin loginState.

      Parameters:
      loginState - loginState
      key - key
      defaultValue - defaultValue
      Returns:
      value