Interface Cloneable<S>

All Known Subinterfaces:
BinaryPersistenceFoundation<F>, EmbeddedStorageConnectionFoundation<F>, PersistenceFoundation<D,​F>, PersistenceManager<D>, PersistenceObjectIdProvider, PersistenceObjectManager<D>, PersistenceObjectRegistry, ViewerBinaryPersistenceManager
All Known Implementing Classes:
BinaryPersistenceFoundation.Default, CompositeIdProvider, DefaultObjectRegistry, EmbeddedStorageConnectionFoundation.Default, FileObjectIdProvider, PersistenceFoundation.Default, PersistenceManager.Default, PersistenceObjectIdProvider.Failing, PersistenceObjectIdProvider.Transient, PersistenceObjectManager.Default, ViewerBinaryPersistenceManager.Default, ViewerObjectRegistryDisabled

public interface Cloneable<S>
  • Method Summary

    Modifier and Type Method Description
    default S Clone()
    This method creates a new instance of the same Class, specified by , of the instance on which this method is called.
  • Method Details

    • Clone

      default S Clone()
      This method creates a new instance of the same Class, specified by , of the instance on which this method is called. Whatever initializations required to create a functional new instance are performed.

      However, this method does NOT create a copy of the current instance. (A common mistake is to confuse cloning with copying: cloning creates a duplicate with only equal initial state while copying creates a duplicate with equal full state. Example: a clone of an adult would not be an identical adult, but just an embryo with equal DNA. A state-wise identical adult would be a copy, not a clone.)

      This method is effectively a constructor called on an existing instance. The use case of such a method is to eliminate the need to redundantly pass a second instance or constructor if a clone of an instance is needed.

      To indicate the constructor-like character of this method, the pattern of starting the name with a capital letter is applied to this method (and to workaround the botch-job protected method the JDK developers hardcoded in Object.)

      Returns:
      a clone of this instance.