private <FACETEDTYPE extends Faceted<?>, FACETTYPE extends Facet<FACETEDTYPE>> FACETTYPE create( Class<FACETTYPE> type) { Assert.notNull(type, "Facet type must not be null."); Imported<FACETTYPE> instance = getAddonRegistry().getServices(type); if (instance.isAmbiguous()) { if (!type.isInterface() && !Modifier.isAbstract(type.getModifiers())) { FACETTYPE facet = instance.selectExact(type); return facet; } throw new FacetIsAmbiguousException("Cannot resolve ambiguous facet type [" + type.getName() + "] because multiple matching types were found: \n" + instance); } else if (instance.isUnsatisfied()) throw new FacetNotFoundException("Could not find Facet of type [" + type.getName() + "]"); else return instance.get(); }