Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.syndication.feed.impl
Class CloneableBean  view CloneableBean download CloneableBean.java

java.lang.Object
  extended bycom.sun.syndication.feed.impl.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.


Field Summary
private  java.util.Set _ignoreProperties
           
private  java.lang.Object _obj
           
private static java.util.Set BASIC_TYPES
           
private static java.util.Map CONSTRUCTOR_BASIC_TYPES
           
private static java.lang.Object[] NO_PARAMS
           
private static java.lang.Class[] NO_PARAMS_DEF
           
 
Constructor Summary
protected CloneableBean()
          Default constructor.
  CloneableBean(java.lang.Object obj)
          Creates a CloneableBean to be used in a delegation pattern.
  CloneableBean(java.lang.Object obj, java.util.Set ignoreProperties)
          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.
private  java.lang.Object cloneArray(java.lang.Object array)
           
private  java.lang.Object cloneCollection(java.util.Collection collection)
           
private  java.lang.Object cloneMap(java.util.Map map)
           
private  java.lang.Object doClone(java.lang.Object value)
           
private  boolean isBasicType(java.lang.Class vClass)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PARAMS_DEF

private static final java.lang.Class[] NO_PARAMS_DEF

NO_PARAMS

private static final java.lang.Object[] NO_PARAMS

_obj

private java.lang.Object _obj

_ignoreProperties

private java.util.Set _ignoreProperties

BASIC_TYPES

private static final java.util.Set BASIC_TYPES

CONSTRUCTOR_BASIC_TYPES

private static final java.util.Map CONSTRUCTOR_BASIC_TYPES
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(this); } public Object clone() throws CloneNotSupportedException { return _cloneableBean.beanClone(); } }


CloneableBean

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

The property names in the ignoreProperties Set will not be copied into the cloned instance. This is useful for cases where the Bean has convenience properties (properties that are actually references to other properties or properties of properties). For example SyndFeed and SyndEntry beans have convenience properties, publishedDate, author, copyright and categories all of them mapped to properties in the DC Module.

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


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,


doClone

private java.lang.Object doClone(java.lang.Object value)
                          throws java.lang.Exception

cloneArray

private java.lang.Object cloneArray(java.lang.Object array)
                             throws java.lang.Exception

cloneCollection

private java.lang.Object cloneCollection(java.util.Collection collection)
                                  throws java.lang.Exception

cloneMap

private java.lang.Object cloneMap(java.util.Map map)
                           throws java.lang.Exception

isBasicType

private boolean isBasicType(java.lang.Class vClass)