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 theFeatureBuilder
viaBuilderContext.addMergeExtensions(MergeHandler...)
. When the feature builder is merging features, the first handler that returnstrue
for an extension incanMerge(Extension)
merges the extension. Further handlers are not tested anymore.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canMerge(Extension extension)
Checks whether this merger can merge the given extension.void
merge(HandlerContext context, Feature target, Feature source, Extension targetEx, Extension sourceEx)
Merge the source extension into the target extension.
-
-
-
Method Detail
-
canMerge
boolean canMerge(Extension extension)
Checks whether this merger can merge the given extension.- Parameters:
extension
- The extension- Returns:
true
if 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 ornull
if the extension does not exist in the target.sourceEx
- The source extension- Throws:
IllegalStateException
- If the extensions can't be merged
-
-