Class DeduplicatingItemIdMergeStrategy

java.lang.Object
net.shibboleth.metadata.DeduplicatingItemIdMergeStrategy
All Implemented Interfaces:
CollectionMergeStrategy

@ThreadSafe public class DeduplicatingItemIdMergeStrategy extends Object implements CollectionMergeStrategy
A merge strategy that adds source items to the target collection if none of the Items in the target collection have the same ItemId as source item. If the source item does not contain a ItemId it is always added to the target collection.
  • Constructor Details

    • DeduplicatingItemIdMergeStrategy

      public DeduplicatingItemIdMergeStrategy()
  • Method Details

    • merge

      public <T> void merge(@Nonnull @NonnullElements List<Item<T>> target, @Nonnull @NonnullElements List<List<Item<T>>> sources)
      Description copied from interface: CollectionMergeStrategy
      Merges the results of each child pipeline in to the collection of Item given to this stage.
      Specified by:
      merge in interface CollectionMergeStrategy
      Type Parameters:
      T - type of data contained in the items
      Parameters:
      target - collection in to which all the Items should be merged, never null
      sources - collections of Items to be merged in to the target, never null not containing any null elements
    • merge

      private <T> void merge(@Nonnull @NonnullElements HashSet<ItemId> presentItemIds, @Nonnull @NonnullElements List<Item<T>> target, @Nonnull @NonnullElements List<Item<T>> sourceItems)
      Adds source items to the target collection if none of the Items in the target collection have the same ItemId as source item. If the source item does not contain a ItemId it is always added to the target collection.
      Type Parameters:
      T - type of data contained in the items
      Parameters:
      presentItemIds - IDs that are already present in the target collection
      target - the collection to which items will be merged in to
      sourceItems - the collection of items to be merged in to the target