org.electrocodeogram.cpc.core.api.data
Interface ICloneObjectExtension

All Superinterfaces:
java.lang.Cloneable, ICloneDataElement, java.io.Serializable
All Known Subinterfaces:
ICloneModificationHistoryExtension, ICloneNonWsPositionExtension, ICloneObjectExtensionInterfaces, ICloneObjectExtensionLazyMultiStatefulObject, ICloneObjectExtensionMultiStatefulObject, ICloneObjectExtensionStatefulObject, IImportCloneObjectExtension, IStoreCloneModificationHistoryExtension

public interface ICloneObjectExtension
extends ICloneDataElement, java.lang.Cloneable, java.io.Serializable

Clone object extensions can be used by 3rd party modules to contribute their own data to any ICloneObject. Once added, such extensions will be persisted and synchronised by CPC automatically.

Any implementation needs to implement ICloneObjectExtensionInterfaces. Implementing only ICloneObjectExtension is not enough!

This interface lists all methods which are available to all CPC plugins and 3rd party contributions.

Additional methods are defined by more specific sub-interfaces which belong to individual CPC plugins and are to be considered private.
Any CPC plugin other than the one designated in the sub-interface API must not access such methods.

General Considerations valid for all ICloneObjectExtension implementations:

Author:
vw
See Also:
ICloneObjectExtensionInterfaces, ICloneFactoryProvider, ICloneObject, ICloneDataElement, Cloneable, Serializable

Method Summary
 java.lang.Object clone()
          All implementations must be cloneable.
 java.lang.Class<? extends ICloneObjectExtension> getExtensionInterfaceClass()
          Returns the ICloneObjectExtension sub-interface which this class is implementing.
 boolean isPartial()
          Checks whether this ICloneObjectExtension object was fully restored from persistent storage.
 void setParentUuid(java.lang.String parentUuid)
          This method will automatically be called, whenever an ICloneObjectExtension is added to an ICloneObject via ICloneObject.addExtension(ICloneObjectExtension).
 java.lang.String toString()
          All implementations should provide a meaningful toString() method for debugging purposes.
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.data.ICloneDataElement
isSealed, seal
 

Method Detail

getExtensionInterfaceClass

java.lang.Class<? extends ICloneObjectExtension> getExtensionInterfaceClass()
Returns the ICloneObjectExtension sub-interface which this class is implementing.
This value has to match the interface for which the implementation was registered with the ICloneFactoryProvider.

I.e. if CloneModificationHistoryExtensionImpl implements ICloneModificationHistoryExtension, it would return ICloneModificationHistoryExtension.class here.

This information could be obtained via reflection. However, as the interface class is potentially used as a Map key internally, the value needs to match exactly. Using reflection under these conditions would be error prone.

Returns:
the interface class which this extension is implementing, never null.

setParentUuid

void setParentUuid(java.lang.String parentUuid)
This method will automatically be called, whenever an ICloneObjectExtension is added to an ICloneObject via ICloneObject.addExtension(ICloneObjectExtension).
A ICloneObjectExtension may only belong to one ICloneObject instance at a time and may not be reused.
Should this method be called multiple times with different parentUuids an IllegalArgumentException is thrown.

IMPORTANT: this method may only be called by the ICloneObject implementation.

Parameters:
parentUuid - the UUID of the parent ICloneObject of this extension object, never null.
Throws:
java.lang.IllegalArgumentException - if a client ties to change the parentUuid of this object.

isPartial

boolean isPartial()
Checks whether this ICloneObjectExtension object was fully restored from persistent storage.
A true value indicates that there may be additional sub-element data available in persistent storage which was not loaded when this element was created.

For all extensions which do not implement ICloneObjectExtensionLazyMultiStatefulObject this method always returns false.

A newly created extensions (which are thus not yet persisted) which implement ICloneObjectExtensionLazyMultiStatefulObject should return true until ICloneObjectExtensionLazyMultiStatefulObject.setPartial(boolean) is used to set a new value.

Returns:
true if this extension object may not have been fully restored, false otherwise.
See Also:
ICloneObjectExtensionLazyMultiStatefulObject.setPartial(boolean)

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
All implementations must be cloneable.

Throws:
java.lang.CloneNotSupportedException

toString

java.lang.String toString()
All implementations should provide a meaningful toString() method for debugging purposes.

Overrides:
toString in class java.lang.Object