Class DeepCopyMapper<T>

  • Type Parameters:
    T - type of entity
    All Implemented Interfaces:
    BiConsumer<T,​T>
    Direct Known Subclasses:
    GraphEntityDeepCopyMapper, ManagedIdDeepCopyMapper

    public class DeepCopyMapper<T>
    extends Object
    implements BiConsumer<T,​T>
    A bi-consumer that tracks the mapping of an original and deep copy that was created such mappings are required when dependencies within the copied instances exist that require updating after-the-fact, e.g., a deep copy of nodes and links where link shave references to nodes. After deep copying both containers, the references to the nodes need updating on the links. this is the mapping that is required to be able to know how to do that
    • Constructor Detail

      • DeepCopyMapper

        public DeepCopyMapper()
    • Method Detail

      • accept

        public void accept​(T original,
                           T deepCopy)
        Track the mapping in internal stateful map
        Specified by:
        accept in interface BiConsumer<T,​T>
        Parameters:
        original - the first input argument
        deepCopy - the second input argument
      • getMapping

        public T getMapping​(T original)
        Collect mapping for the given original
        Parameters:
        original - to get mapping for
        Returns:
        the mapping
      • stream

        public Stream<Map.Entry<T,​T>> stream()
        stream of all mappings found
        Returns:
        stream of mapped entries