private DefaultedFacetAbstract create(final Class<?> cls, final FacetHolder holder) {
final Defaulted annotation = Annotations.getAnnotation(cls, Defaulted.class);
// create from annotation, if present
if (annotation != null) {
final DefaultedFacetAbstract facet = new DefaultedFacetAnnotation(cls, getIsisConfiguration(), holder, getServicesInjector());
if (facet.isValid()) {
return facet;
}
}
// otherwise, try to create from configuration, if present
final String providerName = DefaultsProviderUtil.defaultsProviderNameFromConfiguration(cls, getIsisConfiguration());
if (!Strings.isNullOrEmpty(providerName)) {
final DefaultedFacetFromConfiguration facet = new DefaultedFacetFromConfiguration(providerName, holder, getServicesInjector());
if (facet.isValid()) {
return facet;
}
}
return null;