@Test public void parsesLanguagesWithJustLanguageTag() throws Exception { final Locale expected=Locale.ENGLISH; final Language result = Languages.fromString("en"); assertThat(result,not(nullValue())); assertThat(result.locale(),equalTo(expected)); assertThat(result.isWildcard(),equalTo(false)); assertThat(result.primaryTag(),equalTo(expected.getLanguage())); assertThat(result.subTag(),equalTo(expected.getCountry())); }
public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } private  Languages(); }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2); }
Languages { public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } private  Languages(); static Language wildcard(); static Language of(final Locale locale); static Language fromString(final String language); static boolean includes(final Language language1, final Language language2);  }