@Test void getI18n() { EntityType entityType = mock(EntityType.class); when(entityType.getString("labelEn")).thenReturn("English"); when(entityType.getString("labelNl")).thenReturn("Dutch"); assertEquals( ImmutableMap.of("en", "English", "nl", "Dutch"), MetadataUtils.getI18n(entityType, "label")); }
public static <E extends Entity> ImmutableMap<String, String> getI18n( E entity, String attributeName) { Builder<String, String> builder = ImmutableMap.builder(); getLanguageCodes() .forEach( languageCode -> { String value = entity.getString(getI18nAttributeName(attributeName, languageCode)); if (value != null) { builder.put(languageCode, value); } }); return builder.build(); }
MetadataUtils { public static <E extends Entity> ImmutableMap<String, String> getI18n( E entity, String attributeName) { Builder<String, String> builder = ImmutableMap.builder(); getLanguageCodes() .forEach( languageCode -> { String value = entity.getString(getI18nAttributeName(attributeName, languageCode)); if (value != null) { builder.put(languageCode, value); } }); return builder.build(); } }
MetadataUtils { public static <E extends Entity> ImmutableMap<String, String> getI18n( E entity, String attributeName) { Builder<String, String> builder = ImmutableMap.builder(); getLanguageCodes() .forEach( languageCode -> { String value = entity.getString(getI18nAttributeName(attributeName, languageCode)); if (value != null) { builder.put(languageCode, value); } }); return builder.build(); } private  MetadataUtils(); }
MetadataUtils { public static <E extends Entity> ImmutableMap<String, String> getI18n( E entity, String attributeName) { Builder<String, String> builder = ImmutableMap.builder(); getLanguageCodes() .forEach( languageCode -> { String value = entity.getString(getI18nAttributeName(attributeName, languageCode)); if (value != null) { builder.put(languageCode, value); } }); return builder.build(); } private  MetadataUtils(); static ImmutableMap<String, String> getI18n(
      E entity, String attributeName); }
MetadataUtils { public static <E extends Entity> ImmutableMap<String, String> getI18n( E entity, String attributeName) { Builder<String, String> builder = ImmutableMap.builder(); getLanguageCodes() .forEach( languageCode -> { String value = entity.getString(getI18nAttributeName(attributeName, languageCode)); if (value != null) { builder.put(languageCode, value); } }); return builder.build(); } private  MetadataUtils(); static ImmutableMap<String, String> getI18n(
      E entity, String attributeName);  }