Package org.kuali.rice.krad.uif.util
Class DelayedCopyableHandler
java.lang.Object
org.kuali.rice.krad.uif.util.DelayedCopyableHandler
- All Implemented Interfaces:
InvocationHandler
Proxy invocation handler for delaying deep copy for framework objects that may not need to be
fully traversed by each transaction.
Proxied objects served by this handler will refer to the original source object until a potentially read-write method is invoked. Once such a method is invoked, then the original source is copied to a new object on the fly and the call is forwarded to the copy.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionstatic CopyablegetDelayedCopy(Copyable source) Get a proxy instance providing delayed copy behavior on a source component.Intercept method calls, and copy the original source object as needed.static booleanisPendingDelayedCopy(Copyable source) Determins if a source object is a delayed copy proxy that hasn't been copied yet.
-
Method Details
-
invoke
Intercept method calls, and copy the original source object as needed. The determination that a method is read-write is made based on the method name and/or return type as follows:- Methods starting with "get" or "is", are considered read-only
- Methods returning Copyable, List, Map, or an array, are considered read-write regardless of name
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
isPendingDelayedCopy
Determins if a source object is a delayed copy proxy that hasn't been copied yet.- Parameters:
source- The object to check.- Returns:
- True if source is a delayed copy proxy instance, and hasn't been copied yet.
-
getDelayedCopy
Get a proxy instance providing delayed copy behavior on a source component.- Parameters:
source- The source object- Returns:
- proxy instance wrapping the object
-