Class MessageResolver

java.lang.Object
io.micronaut.views.fields.messages.MessageResolver

public class MessageResolver extends Object
Utility class to resolve message of a Message with a given MessageSource.
Since:
5.6.0
Author:
Sergio del Amo
  • Constructor Details

    • MessageResolver

      public MessageResolver(io.micronaut.context.MessageSource messageSource)
  • Method Details

    • getMessageOrDefault

      @NonNull public @NonNull String getMessageOrDefault(@NonNull @NonNull Message message, @NonNull @NonNull Locale locale)
      Parameters:
      message - The message
      locale - the Locale
      Returns:
      the resolved message or the defaultMessage if the message is not found.
    • getMessage

      @NonNull public @NonNull Optional<String> getMessage(@NonNull @NonNull Message message, @NonNull @NonNull Locale locale)
      Parameters:
      message - The message
      locale - the Locale
      Returns:
      the resolved message or an empty optional if not found.