@JsonIgnore public static LocalizedStrings of(final Map<Locale, String> translations) { requireNonNull(translations); return new LocalizedStrings(translations); }
@JsonIgnore public static LocalizedStrings of(final Locale locale, final String value) { requireNonNull(locale); requireNonNull(value); return new LocalizedStrings(locale, value); }
@JsonIgnore public static LocalizedStrings of(final Locale locale1, final String value1, final Locale locale2, final String value2) { return new LocalizedStrings(mapOf(locale1, value1, locale2, value2)); }
/** * LocalizedStrings containing the given entries. * @param locale the additional locale of the new entry * @param value the value for the <code>locale</code> * @return a LocalizedStrings containing this data and the from the parameters. * @throws IllegalArgumentException if duplicate locales are provided */ public LocalizedStrings plus(final Locale locale, final String value) { if (translations.containsKey(locale)) { throw new IllegalArgumentException(format("Duplicate keys (%s) for map creation.", locale)); } final Map<Locale, String> newMap = ImmutableMapBuilder.<Locale, String>of(). putAll(translations). put(locale, value). build(); return new LocalizedStrings(newMap); }