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