Class UncopyableObjectException

All Implemented Interfaces:
Serializable

public class UncopyableObjectException extends ClonerException
Thrown when the cloner meets a live object of the JVM or the operating system (a thread, a reference, an open file, a socket, a process, an executor) and the developer has not chosen what the clone gets: a clone cannot get its own one, and sharing the original must be chosen explicitly by CopyAction.ORIGINAL (or CopyAction.CLEAR) for the type, the field or the object, or by a copier of the type.

The message tells the classes of the objects holding the uncopyable one, nearest first, as far as they are known: in the sequential mode only the nearest one.

See Also:
  • Constructor Details

    • UncopyableObjectException

      public UncopyableObjectException(Class<?> type)
      Constructor.
      Parameters:
      type - type of the uncopyable object
    • UncopyableObjectException

      public UncopyableObjectException(Class<?> type, String reason, Throwable cause)
      Constructor.
      Parameters:
      type - type of the uncopyable object
      reason - why the object cannot be copied
      cause - cause or null
  • Method Details

    • getType

      public Class<?> getType()
      Returns the type of the uncopyable object.
      Returns:
      type
    • addHolder

      public void addHolder(Class<?> holder)
      Adds the class of an object holding the uncopyable one, farther than the added before.
      Parameters:
      holder - class of the holding object
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable