com.ds.fw.types
Class FwCopyable

java.lang.Object
  |
  +--com.ds.fw.types.FwCopyable
All Implemented Interfaces:
java.lang.Cloneable, FwCopyableIF

public class FwCopyable
extends java.lang.Object
implements FwCopyableIF

I provide a simple example of how to implement FwCopyableIF.


Constructor Summary
FwCopyable()
           
 
Method Summary
 java.lang.Object getClone()
          Get a clone of this object.
 java.lang.Object getCopy()
          Get a copy of this object.
 java.lang.Object getCopy(java.lang.Object e)
          If the object implements FwCopyableIF then return e.getCopy().
 java.lang.Object getDeepCopy()
          Return a copy that is completely independent from the original.
 void postCopy()
          This should never be called directly from a client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FwCopyable

public FwCopyable()
Method Detail

getCopy

public java.lang.Object getCopy()
Description copied from interface: FwCopyableIF
Get a copy of this object. This may return a clone, a deep copy or some hybrid depending on the context of the object being copied.

Specified by:
getCopy in interface FwCopyableIF

getCopy

public java.lang.Object getCopy(java.lang.Object e)
Description copied from interface: FwCopyableIF
If the object implements FwCopyableIF then return e.getCopy(). Otherwise throw an UnsupportedOperationException.

Specified by:
getCopy in interface FwCopyableIF

getDeepCopy

public java.lang.Object getDeepCopy()
Description copied from interface: FwCopyableIF
Return a copy that is completely independent from the original. In general, this means that subsequent changes to the copy should not have any affect on the original.

Specified by:
getDeepCopy in interface FwCopyableIF

postCopy

public void postCopy()
Description copied from interface: FwCopyableIF
This should never be called directly from a client. This method is used to make a clone independent from its original. Subclasses that override this method should always call super.postCopy().

Specified by:
postCopy in interface FwCopyableIF

getClone

public java.lang.Object getClone()
Description copied from interface: FwCopyableIF
Get a clone of this object. This is mainly a convenience method to hide the exception handling. If the instance cannot be cloned return null.

Specified by:
getClone in interface FwCopyableIF