Package org.goplanit.utils.misc
Class DeepCopyMapper<T>
- java.lang.Object
-
- org.goplanit.utils.misc.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 Summary
Constructors Constructor Description DeepCopyMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(T original, T deepCopy)
Track the mapping in internal stateful mapT
getMapping(T original)
Collect mapping for the given originalStream<Map.Entry<T,T>>
stream()
stream of all mappings found-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Method Detail
-
accept
public void accept(T original, T deepCopy)
Track the mapping in internal stateful map- Specified by:
accept
in interfaceBiConsumer<T,T>
- Parameters:
original
- the first input argumentdeepCopy
- 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
-
-