Class ReadWriteSerializationCopyStrategy

  • All Implemented Interfaces:
    java.io.Serializable, ReadWriteCopyStrategy<Element>

    public class ReadWriteSerializationCopyStrategy
    extends java.lang.Object
    implements ReadWriteCopyStrategy<Element>
    A copy strategy that can use partial (if both copy on read and copy on write are set) or full Serialization to copy the object graph
    Author:
    Alex Snaps, Ludovic Orban
    See Also:
    Serialized Form
    • Constructor Detail

      • ReadWriteSerializationCopyStrategy

        public ReadWriteSerializationCopyStrategy()
    • Method Detail

      • copyForWrite

        public Element copyForWrite​(Element value,
                                    java.lang.ClassLoader loader)
        Deep copies some object and returns an internal storage-ready copy
        Specified by:
        copyForWrite in interface ReadWriteCopyStrategy<Element>
        Parameters:
        value - the value to copy
        Returns:
        the storage-ready copy
      • copyForRead

        public Element copyForRead​(Element storedValue,
                                   java.lang.ClassLoader loader)
        Reconstruct an object from its storage-ready copy.
        Specified by:
        copyForRead in interface ReadWriteCopyStrategy<Element>
        Parameters:
        storedValue - the storage-ready copy
        Returns:
        the original object
      • duplicateElementWithNewValue

        public Element duplicateElementWithNewValue​(Element element,
                                                    java.lang.Object newValue)
        Make a duplicate of an element but using the specified value
        Parameters:
        element - the element to duplicate
        newValue - the new element's value
        Returns:
        the duplicated element