Interface LocalizedMessageSource

All Known Implementing Classes:
AbstractLocalizedMessageSource, HttpLocalizedMessageSource

public interface LocalizedMessageSource
Retrieve messages for the resolved locale.
Since:
3.4.0
Author:
Sergio del Amo
  • Method Details

    • getMessage

      Resolve a message for the given code.
      Parameters:
      code - The code
      Returns:
      A message if present
    • getMessage

      @NonNull @NonNull Optional<String> getMessage(@NonNull @NonNull String code, Object... variables)
      Resolve a message for the given code and variables for the messages.
      Parameters:
      code - The code
      variables - to be used to interpolate the message
      Returns:
      A message if present
    • getMessage

      Resolve a message for the given code and variables for the messages.
      Parameters:
      code - The code
      variables - to be used to interpolate the message
      Returns:
      A message if present
    • getMessageOrDefault

      @NonNull default @NonNull String getMessageOrDefault(@NonNull @NonNull String code, @NonNull @NonNull String defaultMessage)
      Resolve a message for the given code. If the message is not present then default message is returned.
      Parameters:
      code - The code
      defaultMessage - The default message to use if no other message is found
      Returns:
      A message if present. If the message is not present then default message supplied is returned.
    • getMessageOrDefault

      @NonNull default @NonNull String getMessageOrDefault(@NonNull @NonNull String code, @NonNull @NonNull String defaultMessage, Object... variables)
      Resolve a message for the given code. If the message is not present then default message is returned.
      Parameters:
      code - The code
      defaultMessage - The default message to use if no other message is found
      variables - to be used to interpolate the message
      Returns:
      A message if present. If the message is not present then default message supplied is returned.
    • getMessageOrDefault

      @NonNull default @NonNull String getMessageOrDefault(@NonNull @NonNull String code, @NonNull @NonNull String defaultMessage, Map<String,Object> variables)
      Resolve a message for the given code. If the message is not present then default message is returned.
      Parameters:
      code - The code
      defaultMessage - The default message to use if no other message is found
      variables - to be used to interpolate the message
      Returns:
      A message if present. If the message is not present then default message supplied is returned.