org.openbp.common.generic
Interface Copyable

All Known Implementing Classes:
CollectionDescriptor, DescriptionObjectImpl, DisplayObjectImpl, DisplayTreeObjectImpl, ObjectDescriptor, PropertyDescriptor, TaggedValue

public interface Copyable

Indicates that an object supports copying it's values and provides a public clone method.

Author:
Heiko Erhardt

Field Summary
static int COPY_DEEP
          Copy mode: Deep copy.
static int COPY_FIRST_LEVEL
          Copy mode: First level copy.
static int COPY_SHALLOW
          Copy mode: Shallow copy.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this.
 void copyFrom(java.lang.Object source, int copyMode)
          Copies the values of the source object to this object.
 

Field Detail

COPY_SHALLOW

static final int COPY_SHALLOW
Copy mode: Shallow copy. Reference copy. The original object and the copied object will reference the same dependent objects.

See Also:
Constant Field Values

COPY_FIRST_LEVEL

static final int COPY_FIRST_LEVEL
Copy mode: First level copy. Collections and maps will be cloned, but the keys and values will reference to the same objects.

See Also:
Constant Field Values

COPY_DEEP

static final int COPY_DEEP
Copy mode: Deep copy. All dependent objects (including collection and map keys/values) will be copied recursively.

See Also:
Constant Field Values
Method Detail

copyFrom

void copyFrom(java.lang.Object source,
              int copyMode)
              throws java.lang.CloneNotSupportedException
Copies the values of the source object to this object.

Parameters:
source - The source object. Must be of the same type as this object.
copyMode - Determines if a deep copy, a first level copy or a shallow copy is to be performed. See the constants of the Copyable class.
Throws:
java.lang.CloneNotSupportedException - If the cloning of one of the contained objects failed

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of this. The clone method is defined by default to be protected. However, we define it to be public in order to be able to invoke it directly from outside the class and not needing to use reflections to call it.

Returns:
The clone (a deep copy of this object)
Throws:
java.lang.CloneNotSupportedException - If the cloning of one of the contained objects failed


Copyright © 2011. All Rights Reserved.