Class MessageResolver
java.lang.Object
io.micronaut.views.fields.messages.MessageResolver
Utility class to resolve message of a
Message
with a given MessageSource
.- Since:
- 5.6.0
- Author:
- Sergio del Amo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetMessage
(@NonNull Message message, @NonNull Locale locale) @NonNull String
getMessageOrDefault
(@NonNull Message message, @NonNull Locale locale)
-
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 messagelocale
- 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 messagelocale
- the Locale- Returns:
- the resolved message or an empty optional if not found.
-