in src/main/java/org/apache/sling/feature/diff/impl/FeatureDiffImpl.java [40:74]
public static Feature compareFeatures(DiffRequest diffRequest) {
requireNonNull(diffRequest, "Impossible to compare features without specifying them.");
Feature previous = requireNonNull(diffRequest.getPrevious(), "Impossible to compare null previous feature.");
Feature current = requireNonNull(diffRequest.getCurrent(), "Impossible to compare null current feature.");
if (previous.getId().equals(current.getId())) {
throw new IllegalArgumentException("Input Features refer to the the same Feature version.");
}
StringBuilder classifier = new StringBuilder();
if (current.getId().getClassifier() != null && !current.getId().getClassifier().isEmpty()) {
classifier.append(current.getId().getClassifier())
.append('_');
}
classifier.append(UPDATER_CLASSIFIER);
ArtifactId resultId = new ArtifactId(current.getId().getGroupId(),
current.getId().getArtifactId(),
current.getId().getVersion(),
classifier.toString(),
current.getId().getType());
Feature target = new Feature(resultId);
target.setTitle(previous.getId() + " to " + current.getId());
target.setDescription("Computed " + previous.getId() + " to " + current.getId() + " Feature update");
Prototype prototype = new Prototype(previous.getId());
target.setPrototype(prototype);
for (FeatureElementComparator comparator : loadComparators(diffRequest)) {
comparator.computeDiff(previous, current, target);
}
return target;
}