final ActionDefaultsFacet facet = getFacet(ActionDefaultsFacet.class);
if (!facet.isNoop()) {
// use the old defaultXxx approach
parameterDefaultPojos = facet.getDefaults(realTarget);
if (parameterDefaultPojos.length != parameterCount) {
throw new DomainModelException("Defaults array of incompatible size; expected " + parameterCount + " elements, but was " + parameterDefaultPojos.length + " for " + facet);
}
for (int i = 0; i < parameterCount; i++) {
if (parameterDefaultPojos[i] != null) {
final ObjectSpecification componentSpec = getSpecificationLookup().loadSpecification(parameterDefaultPojos[i].getClass());
final ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
if (!componentSpec.isOfType(parameterSpec)) {
throw new DomainModelException("Defaults type incompatible with parameter " + (i + 1) + " type; expected " + parameterSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
}
}
}
} else {
// use the new defaultNXxx approach for each param in turn