Top Description Fields Constructors Methods
com.rometools.rome.feed.impl

public Class CloneableBean

extends Object
Class Inheritance
Imports
java.lang.reflect.Array, .InvocationTargetException, .Method, .Modifier, java.util.ArrayList, .Collection, .HashMap, .HashSet, .List, .Map, .Map.Entry, .Set, .SortedMap, .SortedSet, .TreeMap, .TreeSet, org.slf4j.Logger, .LoggerFactory

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

Modifier and TypeField and Description
private static final Set<Class<?>>
private static final Logger
private static final Object[]
private static final Class<?>[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Object

Returns:

a clone of the object bean.
beanClone
(Object obj, Set<String> ignoreProperties)

Makes a deep bean clone of the object passed in the constructor.

private static <T> T
cloneArray(final T array)

private static <T> Collection<T>
cloneCollection(final Collection<T> collection)

private static <K, V> Map<K, V>
cloneMap(final Map<K, V> map)

private static <T> T
doClone(T value)

private static boolean
isBasicType(final Class<?> vClass)

private static <T extends Collection<E>, E> Collection<E>
private static <T extends Map<K, V>, K, V> Map<K, V>
newMap(Class<T> type)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASIC_TYPESback to summary
private static final Set<Class<?>> BASIC_TYPES
LOGback to summary
private static final Logger LOG
NO_PARAMSback to summary
private static final Object[] NO_PARAMS
NO_PARAMS_DEFback to summary
private static final Class<?>[] NO_PARAMS_DEF

Constructor Detail

CloneableBeanback to summary
private CloneableBean()

Method Detail

beanCloneback to summary
public static Object beanClone(Object obj, Set<String> ignoreProperties) throws 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:Object

a clone of the object bean.

Exceptions
CloneNotSupportedException:
thrown if the object bean could not be cloned.
cloneArrayback to summary
private static <T> T cloneArray(final T array) throws Exception
cloneCollectionback to summary
private static <T> Collection<T> cloneCollection(final Collection<T> collection) throws Exception
cloneMapback to summary
private static <K, V> Map<K, V> cloneMap(final Map<K, V> map) throws Exception
doCloneback to summary
private static <T> T doClone(T value) throws Exception
Annotations
@SuppressWarnings:unchecked
isBasicTypeback to summary
private static boolean isBasicType(final Class<?> vClass)
newCollectionback to summary
private static <T extends Collection<E>, E> Collection<E> newCollection(Class<T> type) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
newMapback to summary
private static <T extends Map<K, V>, K, V> Map<K, V> newMap(Class<T> type) throws InstantiationException, IllegalAccessException