org.zodiac.reactor.locale.UnsupportedMessageSource Maven / Gradle / Ivy
The newest version!
package org.zodiac.reactor.locale;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceResolvable;
import org.springframework.context.NoSuchMessageException;
import java.util.Locale;
public class UnsupportedMessageSource implements MessageSource {
public static MessageSource instance() {
return UnsupportedMessageSourceHolder.INSTANCE;
}
@Override
public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
return defaultMessage;
}
@Override
public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
return code;
}
@Override
public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
return resolvable.getDefaultMessage();
}
private static class UnsupportedMessageSourceHolder {
private static final UnsupportedMessageSource INSTANCE = new UnsupportedMessageSource();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy