|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.krad.uif.util.CopyUtils
public final class CopyUtils
Provides a lightweight "hands-free" copy implementation to replace the need for copyProperties()
in building LifecycleElement
implementations.
Constructor Summary | |
---|---|
CopyUtils()
|
Method Summary | ||
---|---|---|
static
|
copy(Copyable obj)
Mix-in copy implementation for objects that implement the Copyable interface} |
|
static
|
getDeepCopy(T obj)
Get a deep copy of an object using cloning. |
|
static
|
getShallowCopy(T obj)
Get a shallow copy (clone) of an object. |
|
static boolean |
isDeepCopyAvailable(Class<?> type)
Determine if deep copying is available for a type. |
|
static boolean |
isDelay()
Determine whether or not to use a delayed copy proxy. |
|
static
|
isShallowCopyAvailable(T obj)
Determine if shallow copying is available on an object. |
|
static void |
preventModification(Copyable obj)
Prepare a copyable object for caching by calling Copyable.preventModification() on
all copyable instances located by a deep traversal of the object. |
|
static
|
unwrapDeep(Copyable obj)
Prepare a copyable object for caching by calling Copyable.preventModification() on
all copyable instances located by a deep traversal of the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CopyUtils()
Method Detail |
---|
public static boolean isDelay()
When true, and #isUseClone()
is also true, then deep copy operations will be
truncated where a copyable represented by an interfaces is specified by the field, array,
list or map involved indicated. Rather than copy the object directly, a proxy wrapping the
original will be placed, which when used will invoke the copy operation.
This value is controlled by the parameter "krad.uif.copyable.delay". By default, full deep copy will be used.
public static <T> T copy(Copyable obj)
Copyable
interface}
T
- copyable typeobj
- The object to copy.
public static <T> boolean isShallowCopyAvailable(T obj)
T
- copyable typeobj
- The object to check.
getShallowCopy(Object)
may be expected to return a shallow copy of
the object. False if a null return value is expected.public static boolean isDeepCopyAvailable(Class<?> type)
type
- The type to check.
getDeepCopy(Object)
may be expected to follow references to this
type. False if the type should not be deeply copied.public static <T> T getShallowCopy(T obj) throws CloneNotSupportedException
This method simplifies access to the clone() method.
T
- copyable typeobj
- The object to clone.
CloneNotSupportedException
- If copying is not available on the object, or if thrown by
clone() itself. When isShallowCopyAvailable() returns true, then this exception is
not expected and may be considered an internal error.public static void preventModification(Copyable obj)
Copyable.preventModification()
on
all copyable instances located by a deep traversal of the object.
obj
- The object to prepare for caching.public static <T extends Copyable> T unwrapDeep(Copyable obj)
Copyable.preventModification()
on
all copyable instances located by a deep traversal of the object.
T
- copyable typeobj
- The object to prepare for caching.
public static <T> T getDeepCopy(T obj)
T
- copyable typeobj
- The object to get a deep copy of.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |