@Test public void canConvert() throws Exception { for (MediaIdType type : Arrays.asList(MediaIdType.IMDB, MediaIdType.TMDB, MediaIdType.MOVIETITLE)) { for (MediaIdType type2 : Arrays.asList(MediaIdType.IMDB, MediaIdType.TMDB, MediaIdType.MOVIETITLE)) { assertTrue(testee.canConvert(type, type2)); } } for (MediaIdType type : Arrays.asList(MediaIdType.TVMAZE, MediaIdType.TVDB, MediaIdType.TVRAGE, MediaIdType.TVTITLE, MediaIdType.TVIMDB)) { for (MediaIdType type2 : Arrays.asList(MediaIdType.TVMAZE, MediaIdType.TVDB, MediaIdType.TVRAGE, MediaIdType.TVTITLE, MediaIdType.TVIMDB)) { assertTrue("Should be able to convert " + type + " to " + type2, testee.canConvert(type, type2)); } } }
public boolean canConvert(MediaIdType from, MediaIdType to) { return canConvertMap.get(from).contains(to); }
InfoProvider { public boolean canConvert(MediaIdType from, MediaIdType to) { return canConvertMap.get(from).contains(to); } }
InfoProvider { public boolean canConvert(MediaIdType from, MediaIdType to) { return canConvertMap.get(from).contains(to); }  }
InfoProvider { public boolean canConvert(MediaIdType from, MediaIdType to) { return canConvertMap.get(from).contains(to); }  boolean canConvert(MediaIdType from, MediaIdType to); static Set<MediaIdType> getConvertibleFrom(MediaIdType from); boolean canConvertAny(Set<MediaIdType> from, Set<MediaIdType> to); MediaInfo convert(Map<MediaIdType, String> identifiers); @Cacheable(cacheNames = "infos", sync = true) //sync=true is currently apparently not supported by Caffeine. synchronizing by method is good enough because we'll likely rarely hit this method concurrently with different parameters synchronized MediaInfo convert(String value, MediaIdType fromType); TvInfo findTvInfoInDatabase(Map<MediaIdType, String> ids); MovieInfo findMovieInfoInDatabase(Map<MediaIdType, String> ids); @Cacheable(cacheNames = "titles", sync = true) List<MediaInfo> search(String title, MediaIdType titleType); }
InfoProvider { public boolean canConvert(MediaIdType from, MediaIdType to) { return canConvertMap.get(from).contains(to); }  boolean canConvert(MediaIdType from, MediaIdType to); static Set<MediaIdType> getConvertibleFrom(MediaIdType from); boolean canConvertAny(Set<MediaIdType> from, Set<MediaIdType> to); MediaInfo convert(Map<MediaIdType, String> identifiers); @Cacheable(cacheNames = "infos", sync = true) //sync=true is currently apparently not supported by Caffeine. synchronizing by method is good enough because we'll likely rarely hit this method concurrently with different parameters synchronized MediaInfo convert(String value, MediaIdType fromType); TvInfo findTvInfoInDatabase(Map<MediaIdType, String> ids); MovieInfo findMovieInfoInDatabase(Map<MediaIdType, String> ids); @Cacheable(cacheNames = "titles", sync = true) List<MediaInfo> search(String title, MediaIdType titleType); static Set<MediaIdType> TV_ID_TYPES; static Set<MediaIdType> MOVIE_ID_TYPES; static Set<MediaIdType> REAL_ID_TYPES; }