com.ds.fw.types
Interface FwCopyableIF

All Superinterfaces:
java.lang.Cloneable
All Known Subinterfaces:
FwAssociationIF, FwBooleanIF, FwDateIF, FwDateIntervalIF, FwIntegerIF, FwListIF, FwMoneyIF, FwSimpleObjectIF, FwTimeIF, FwTimestampIF, FwUniqueObjectIF
All Known Implementing Classes:
FwAssociation, FwBoolean, FwCopyable, FwDate, FwDateInterval, FwInteger, FwList, FwMoney, FwSimpleObject, FwTime, FwTimestamp, FwUniqueObject

public interface FwCopyableIF
extends java.lang.Cloneable

I define the basic methods used to create shallow and deep copies of objects and object graphs. In general subclasses should only override postCopy().


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.
 

Method Detail

getClone

public java.lang.Object getClone()
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.


getCopy

public java.lang.Object getCopy()
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.


getCopy

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


getDeepCopy

public java.lang.Object getDeepCopy()
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.


postCopy

public void postCopy()
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().