Package org.apache.sling.feature.builder
Interface MergeHandler
@ConsumerType
public interface MergeHandler
A merge handler can merge an extension of a particular type. The handlers are
passed in to the
FeatureBuilder via
BuilderContext.addMergeExtensions(MergeHandler...). When the feature
builder is merging features, the first handler that returns true for
an extension in canMerge(Extension) merges the extension. Further
handlers are not tested anymore.-
Method Summary
-
Method Details
-
canMerge
Checks whether this merger can merge the given extension.- Parameters:
extension- The extension- Returns:
trueif merger can handle this
-
merge
void merge(HandlerContext context, Feature target, Feature source, Extension targetEx, Extension sourceEx) Merge the source extension into the target extension. Only called ifcanMerge(Extension)for the extension returnedtrue. If the target does not yet contain this extension, then the targetEx argument isnull. In that case the handler should add the extension to the target.- Parameters:
context- Context for the handlertarget- The target featuresource- The source featuretargetEx- The target extension ornullif the extension does not exist in the target.sourceEx- The source extension- Throws:
IllegalStateException- If the extensions can't be merged
-