Search in sources :

Example 1 with MessageSource

use of io.micronaut.context.MessageSource in project micronaut-core by micronaut-projects.

the class CompositeMessageSource method getRawMessage.

@NonNull
@Override
public Optional<String> getRawMessage(@NonNull String code, @NonNull MessageContext context) {
    ArgumentUtils.requireNonNull("code", code);
    ArgumentUtils.requireNonNull("context", context);
    for (MessageSource messageSource : messageSources) {
        final Optional<String> message = messageSource.getRawMessage(code, context);
        if (message.isPresent()) {
            return message;
        }
    }
    return Optional.empty();
}
Also used : AbstractMessageSource(io.micronaut.context.AbstractMessageSource) MessageSource(io.micronaut.context.MessageSource) NonNull(io.micronaut.core.annotation.NonNull)

Aggregations

AbstractMessageSource (io.micronaut.context.AbstractMessageSource)1 MessageSource (io.micronaut.context.MessageSource)1 NonNull (io.micronaut.core.annotation.NonNull)1