@Test public void get_missing_plugin_implementations() { List<Plugin> plugins = new ArrayList<>(); FacetRegistry registry = new FacetRegistry(plugins); List<LegacyPlugin> legacyPlugins = registry.getFacets(LegacyPlugin.class); Assertions.assertThat(legacyPlugins).hasSize(0); }
@SuppressWarnings("unchecked") <T> List<T> getFacets(@Nullable Class<T> facet) { if (facet != null && Plugin.class.isAssignableFrom(facet)) { List<T> ts = new ArrayList<>(); Plugin plugin = pluginsByClass.get(facet); if (plugin != null) { ts.add((T) plugin); } return ts; } return (List<T>) pluginsByFacet.get(facet); }
FacetRegistry { @SuppressWarnings("unchecked") <T> List<T> getFacets(@Nullable Class<T> facet) { if (facet != null && Plugin.class.isAssignableFrom(facet)) { List<T> ts = new ArrayList<>(); Plugin plugin = pluginsByClass.get(facet); if (plugin != null) { ts.add((T) plugin); } return ts; } return (List<T>) pluginsByFacet.get(facet); } }
FacetRegistry { @SuppressWarnings("unchecked") <T> List<T> getFacets(@Nullable Class<T> facet) { if (facet != null && Plugin.class.isAssignableFrom(facet)) { List<T> ts = new ArrayList<>(); Plugin plugin = pluginsByClass.get(facet); if (plugin != null) { ts.add((T) plugin); } return ts; } return (List<T>) pluginsByFacet.get(facet); } FacetRegistry(final Collection<Plugin> plugins); }
FacetRegistry { @SuppressWarnings("unchecked") <T> List<T> getFacets(@Nullable Class<T> facet) { if (facet != null && Plugin.class.isAssignableFrom(facet)) { List<T> ts = new ArrayList<>(); Plugin plugin = pluginsByClass.get(facet); if (plugin != null) { ts.add((T) plugin); } return ts; } return (List<T>) pluginsByFacet.get(facet); } FacetRegistry(final Collection<Plugin> plugins);  }
FacetRegistry { @SuppressWarnings("unchecked") <T> List<T> getFacets(@Nullable Class<T> facet) { if (facet != null && Plugin.class.isAssignableFrom(facet)) { List<T> ts = new ArrayList<>(); Plugin plugin = pluginsByClass.get(facet); if (plugin != null) { ts.add((T) plugin); } return ts; } return (List<T>) pluginsByFacet.get(facet); } FacetRegistry(final Collection<Plugin> plugins);   }