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

    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 Details

    • 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 if canMerge(Extension) for the extension returned true. If the target does not yet contain this extension, then the targetEx argument is null. In that case the handler should add the extension to the target.
      Parameters:
      context - Context for the handler
      target - The target feature
      source - The source feature
      targetEx - The target extension or null if the extension does not exist in the target.
      sourceEx - The source extension
      Throws:
      IllegalStateException - If the extensions can't be merged