com.sun.syndication.common
Class CloneableBean

java.lang.Object
  extended bycom.sun.syndication.common.CloneableBean
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class CloneableBean
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Provides deep Bean clonning support.

It works on all read/write properties, recursively. It support all primitive types, Strings, Collections, Cloneable objects and multi-dimensional arrays of any of them.

Author:
Alejandro Abdelnur
See Also:
Serialized Form

Constructor Summary
protected CloneableBean()
          Default constructor.
  CloneableBean(java.lang.Object obj)
          Creates a CloneableBean to be used in a delegation pattern.
 
Method Summary
 java.lang.Object beanClone()
          Makes a deep bean clone of the object passed in the constructor.
 java.lang.Object clone()
          Makes a deep bean clone of the object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloneableBean

protected CloneableBean()
Default constructor.

To be used by classes extending CloneableBean only.


CloneableBean

public CloneableBean(java.lang.Object obj)
Creates a CloneableBean to be used in a delegation pattern.

For example:

public class Foo implements Cloneable { private CloneableBean _cloneableBean; public Foo() { _cloneableBean = new CloneableBean(); } public Object clone() throws CloneNotSupportedException { return _cloneableBean.beanClone(); } }

Parameters:
obj - object bean to clone.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Makes a deep bean clone of the object.

To be used by classes extending CloneableBean. Although it works also for classes using CloneableBean in a delegation pattern, for correctness those classes should use the

Returns:
a clone of the object bean.
Throws:
java.lang.CloneNotSupportedException - thrown if the object bean could not be cloned.
See Also:
beanClone method.


beanClone

public java.lang.Object beanClone()
                           throws java.lang.CloneNotSupportedException
Makes a deep bean clone of the object passed in the constructor.

To be used by classes using CloneableBean in a delegation pattern,

Returns:
a clone of the object bean.
Throws:
java.lang.CloneNotSupportedException - thrown if the object bean could not be cloned.
See Also:
constructor.


Copyright © 2004 Sun Microsystems. All Rights Reserved.